mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r16917) -Codechange: fix some GCC 4.5 'case X is not in enum Y' warnings
This commit is contained in:
parent
13a7c550ad
commit
3bcfa7c52a
|
@ -266,14 +266,14 @@ static int32 LookupWithBuildOnSlopes(::Slope slope, Array *existing, int32 start
|
||||||
case SLOPE_W:
|
case SLOPE_W:
|
||||||
/* A slope similar to a SLOPE_W. */
|
/* A slope similar to a SLOPE_W. */
|
||||||
switch (new_roadbits) {
|
switch (new_roadbits) {
|
||||||
case 6: // ROAD_SE | ROAD_SW:
|
case ROAD_N:
|
||||||
case 9: // ROAD_NE | ROAD_NW:
|
case ROAD_E:
|
||||||
case 12: // ROAD_NE | ROAD_SE:
|
case ROAD_S:
|
||||||
/* Cannot build anything with a turn from the low side. */
|
/* Cannot build anything with a turn from the low side. */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case 5: // ROAD_SE | ROAD_NW:
|
case ROAD_X:
|
||||||
case 10: // ROAD_NE | ROAD_SW:
|
case ROAD_Y:
|
||||||
/* A 'sloped' tile is going to be build. */
|
/* A 'sloped' tile is going to be build. */
|
||||||
if ((existing_roadbits | new_roadbits) != new_roadbits) {
|
if ((existing_roadbits | new_roadbits) != new_roadbits) {
|
||||||
/* There is already a foundation on the tile, or at least
|
/* There is already a foundation on the tile, or at least
|
||||||
|
@ -282,25 +282,25 @@ static int32 LookupWithBuildOnSlopes(::Slope slope, Array *existing, int32 start
|
||||||
}
|
}
|
||||||
/* If the start is in the low part, it is automatically
|
/* If the start is in the low part, it is automatically
|
||||||
* building the second part too. */
|
* 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:
|
default:
|
||||||
/* Roadbits causing a foundation are going to be build.
|
/* Roadbits causing a foundation are going to be build.
|
||||||
* When the existing roadbits are slopes (the lower bits
|
* When the existing roadbits are slopes (the lower bits
|
||||||
* are used), this cannot be done. */
|
* are used), this cannot be done. */
|
||||||
if ((existing_roadbits | new_roadbits) == new_roadbits) return 1;
|
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:
|
case SLOPE_SW:
|
||||||
/* A slope similar to a SLOPE_SW. */
|
/* A slope similar to a SLOPE_SW. */
|
||||||
switch (new_roadbits) {
|
switch (new_roadbits) {
|
||||||
case 9: // ROAD_NE | ROAD_NW:
|
case ROAD_N:
|
||||||
case 12: // ROAD_NE | ROAD_SE:
|
case ROAD_E:
|
||||||
/* Cannot build anything with a turn from the low side. */
|
/* Cannot build anything with a turn from the low side. */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case 10: // ROAD_NE | ROAD_SW:
|
case ROAD_X:
|
||||||
/* A 'sloped' tile is going to be build. */
|
/* A 'sloped' tile is going to be build. */
|
||||||
if ((existing_roadbits | new_roadbits) != new_roadbits) {
|
if ((existing_roadbits | new_roadbits) != new_roadbits) {
|
||||||
/* There is already a foundation on the tile, or at least
|
/* There is already a foundation on the tile, or at least
|
||||||
|
|
|
@ -1824,7 +1824,7 @@ static void SetDefaultRailGui()
|
||||||
extern RailType _last_built_railtype;
|
extern RailType _last_built_railtype;
|
||||||
RailType rt = (RailType)_settings_client.gui.default_rail_type;
|
RailType rt = (RailType)_settings_client.gui.default_rail_type;
|
||||||
if (rt >= RAILTYPE_END) {
|
if (rt >= RAILTYPE_END) {
|
||||||
if (rt == RAILTYPE_END + 2) {
|
if (rt == DEF_RAILTYPE_MOST_USED) {
|
||||||
/* Find the most used rail type */
|
/* Find the most used rail type */
|
||||||
RailType count[RAILTYPE_END];
|
RailType count[RAILTYPE_END];
|
||||||
memset(count, 0, sizeof(count));
|
memset(count, 0, sizeof(count));
|
||||||
|
@ -1841,15 +1841,15 @@ static void SetDefaultRailGui()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No rail, just get the first available one */
|
/* 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) {
|
switch (rt) {
|
||||||
case RAILTYPE_END + 0:
|
case DEF_RAILTYPE_FIRST:
|
||||||
rt = RAILTYPE_RAIL;
|
rt = RAILTYPE_RAIL;
|
||||||
while (rt < RAILTYPE_END && !HasRailtypeAvail(_local_company, rt)) rt++;
|
while (rt < RAILTYPE_END && !HasRailtypeAvail(_local_company, rt)) rt++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RAILTYPE_END + 1:
|
case DEF_RAILTYPE_LAST:
|
||||||
rt = GetBestRailtype(_local_company);
|
rt = GetBestRailtype(_local_company);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,11 @@ enum RailType {
|
||||||
RAILTYPE_MONO = 2, ///< Monorail
|
RAILTYPE_MONO = 2, ///< Monorail
|
||||||
RAILTYPE_MAGLEV = 3, ///< Maglev
|
RAILTYPE_MAGLEV = 3, ///< Maglev
|
||||||
RAILTYPE_END, ///< Used for iterations
|
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 */
|
/** Allow incrementing of Track variables */
|
||||||
|
|
|
@ -51,6 +51,12 @@ enum RoadBits {
|
||||||
ROAD_NE = 8U, ///< North-east part
|
ROAD_NE = 8U, ///< North-east part
|
||||||
ROAD_X = ROAD_SW | ROAD_NE, ///< Full road along the x-axis (south-west + north-east)
|
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_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
|
ROAD_ALL = ROAD_X | ROAD_Y ///< Full 4-way crossing
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_AS_BIT_SET(RoadBits);
|
DECLARE_ENUM_AS_BIT_SET(RoadBits);
|
||||||
|
|
|
@ -204,18 +204,20 @@ static bool FixTTOMapArray()
|
||||||
{
|
{
|
||||||
for (TileIndex t = 0; t < OLD_MAP_SIZE; t++) {
|
for (TileIndex t = 0; t < OLD_MAP_SIZE; t++) {
|
||||||
TileType tt = GetTileType(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) {
|
switch (tt) {
|
||||||
case MP_CLEAR:
|
case MP_CLEAR:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_RAILWAY:
|
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)) {
|
switch (GB(_m[t].m5, 6, 2)) {
|
||||||
case 0: // RAIL_TILE_NORMAL
|
case 0: // RAIL_TILE_NORMAL
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue