Changeset - r12470:62669b41f044
[Not reviewed]
master
0 5 0
rubidium - 15 years ago 2009-07-22 16:56:36
rubidium@openttd.org
(svn r16917) -Codechange: fix some GCC 4.5 'case X is not in enum Y' warnings
5 files changed with 33 insertions and 21 deletions:
0 comments (0 inline, 0 general)
src/ai/api/ai_road.cpp
Show inline comments
 
@@ -266,14 +266,14 @@ static int32 LookupWithBuildOnSlopes(::S
 
		case SLOPE_W:
 
			/* A slope similar to a SLOPE_W. */
 
			switch (new_roadbits) {
 
				case  6: // ROAD_SE | ROAD_SW:
 
				case  9: // ROAD_NE | ROAD_NW:
 
				case 12: // ROAD_NE | ROAD_SE:
 
				case ROAD_N:
 
				case ROAD_E:
 
				case ROAD_S:
 
					/* Cannot build anything with a turn from the low side. */
 
					return 0;
 

	
 
				case  5: // ROAD_SE | ROAD_NW:
 
				case 10: // ROAD_NE | ROAD_SW:
 
				case ROAD_X:
 
				case ROAD_Y:
 
					/* A 'sloped' tile is going to be build. */
 
					if ((existing_roadbits | new_roadbits) != new_roadbits) {
 
						/* There is already a foundation on the tile, or at least
 
@@ -282,25 +282,25 @@ static int32 LookupWithBuildOnSlopes(::S
 
					}
 
					/* If the start is in the low part, it is automatically
 
					 * building the second part too. */
 
					return ((start_roadbits & (ROAD_NE | ROAD_SE)) && !(existing_roadbits & (ROAD_SW | ROAD_NW))) ? 2 : 1;
 
					return ((start_roadbits & ROAD_E) && !(existing_roadbits & ROAD_W)) ? 2 : 1;
 

	
 
				default:
 
					/* Roadbits causing a foundation are going to be build.
 
					 * When the existing roadbits are slopes (the lower bits
 
					 * are used), this cannot be done. */
 
					if ((existing_roadbits | new_roadbits) == new_roadbits) return 1;
 
					return (existing_roadbits & (ROAD_NE | ROAD_SE)) ? 0 : 1;
 
					return (existing_roadbits & ROAD_E) ? 0 : 1;
 
			}
 

	
 
		case SLOPE_SW:
 
			/* A slope similar to a SLOPE_SW. */
 
			switch (new_roadbits) {
 
				case  9: // ROAD_NE | ROAD_NW:
 
				case 12: // ROAD_NE | ROAD_SE:
 
				case ROAD_N:
 
				case ROAD_E:
 
					/* Cannot build anything with a turn from the low side. */
 
					return 0;
 

	
 
				case 10: // ROAD_NE | ROAD_SW:
 
				case ROAD_X:
 
					/* A 'sloped' tile is going to be build. */
 
					if ((existing_roadbits | new_roadbits) != new_roadbits) {
 
						/* There is already a foundation on the tile, or at least
src/rail_gui.cpp
Show inline comments
 
@@ -1824,7 +1824,7 @@ static void SetDefaultRailGui()
 
	extern RailType _last_built_railtype;
 
	RailType rt = (RailType)_settings_client.gui.default_rail_type;
 
	if (rt >= RAILTYPE_END) {
 
		if (rt == RAILTYPE_END + 2) {
 
		if (rt == DEF_RAILTYPE_MOST_USED) {
 
			/* Find the most used rail type */
 
			RailType count[RAILTYPE_END];
 
			memset(count, 0, sizeof(count));
 
@@ -1841,15 +1841,15 @@ static void SetDefaultRailGui()
 
			}
 

	
 
			/* No rail, just get the first available one */
 
			if (count[rt] == 0) rt = RAILTYPE_END;
 
			if (count[rt] == 0) rt = DEF_RAILTYPE_FIRST;
 
		}
 
		switch (rt) {
 
			case RAILTYPE_END + 0:
 
			case DEF_RAILTYPE_FIRST:
 
				rt = RAILTYPE_RAIL;
 
				while (rt < RAILTYPE_END && !HasRailtypeAvail(_local_company, rt)) rt++;
 
				break;
 

	
 
			case RAILTYPE_END + 1:
 
			case DEF_RAILTYPE_LAST:
 
				rt = GetBestRailtype(_local_company);
 
				break;
 

	
src/rail_type.h
Show inline comments
 
@@ -21,7 +21,11 @@ enum RailType {
 
	RAILTYPE_MONO     = 2,          ///< Monorail
 
	RAILTYPE_MAGLEV   = 3,          ///< Maglev
 
	RAILTYPE_END,                   ///< Used for iterations
 
	INVALID_RAILTYPE  = 0xFF        ///< Flag for invalid railtype
 
	INVALID_RAILTYPE  = 0xFF,       ///< Flag for invalid railtype
 

	
 
	DEF_RAILTYPE_FIRST = RAILTYPE_END, ///< Default railtype: first available
 
	DEF_RAILTYPE_LAST,                 ///< Default railtype: last available
 
	DEF_RAILTYPE_MOST_USED,            ///< Default railtype: most used
 
};
 

	
 
/** Allow incrementing of Track variables */
src/road_type.h
Show inline comments
 
@@ -51,6 +51,12 @@ enum RoadBits {
 
	ROAD_NE   = 8U,                  ///< North-east part
 
	ROAD_X    = ROAD_SW | ROAD_NE,   ///< Full road along the x-axis (south-west + north-east)
 
	ROAD_Y    = ROAD_NW | ROAD_SE,   ///< Full road along the y-axis (north-west + south-east)
 

	
 
	ROAD_N    = ROAD_NE | ROAD_NW,   ///< Road at the two northern edges
 
	ROAD_E    = ROAD_NE | ROAD_SE,   ///< Road at the two eastern edges
 
	ROAD_S    = ROAD_SE | ROAD_SW,   ///< Road at the two southern edges
 
	ROAD_W    = ROAD_NW | ROAD_SW,   ///< Road at the two western edges
 

	
 
	ROAD_ALL  = ROAD_X  | ROAD_Y     ///< Full 4-way crossing
 
};
 
DECLARE_ENUM_AS_BIT_SET(RoadBits);
src/saveload/oldloader_sl.cpp
Show inline comments
 
@@ -204,18 +204,20 @@ static bool FixTTOMapArray()
 
{
 
	for (TileIndex t = 0; t < OLD_MAP_SIZE; t++) {
 
		TileType tt = GetTileType(t);
 
		if (tt == 11) {
 
			/* TTO has a different way of storing monorail.
 
			 * Instead of using bits in m3 it uses a different tile type. */
 
			_m[t].m3 = 1; // rail type = monorail (in TTD)
 
			SetTileType(t, MP_RAILWAY);
 
			_m[t].m2 = 1; // set monorail ground to RAIL_GROUND_GRASS
 
			tt = MP_RAILWAY;
 
		}
 

	
 
		switch (tt) {
 
			case MP_CLEAR:
 
				break;
 

	
 
			case MP_RAILWAY:
 
			case 11: // monorail
 
				if (tt == 11) {
 
					_m[t].m3 = 1; // rail type = monorail
 
					_m[t].type_height &= 0x1F; // -> MP_RAILWAY
 
					_m[t].m2 = 1; // set monorail ground to RAIL_GROUND_GRASS
 
				}
 
				switch (GB(_m[t].m5, 6, 2)) {
 
					case 0: // RAIL_TILE_NORMAL
 
						break;
0 comments (0 inline, 0 general)