(svn r27893) -Codechange: Use fallthrough attribute. (LordAro)

This commit is contained in:
frosch
2017-08-13 18:38:42 +00:00
parent 34cd504d65
commit a47fb85cd8
60 changed files with 221 additions and 121 deletions

View File

@@ -554,8 +554,8 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
if (IsLevelCrossing(tile) && GetCrossingRailBits(tile) == trackbit) {
return_cmd_error(STR_ERROR_ALREADY_BUILT);
}
/* FALL THROUGH */
}
FALLTHROUGH;
default: {
/* Will there be flat water on the lower halftile? */
@@ -2444,33 +2444,60 @@ static void DrawTile_Track(TileInfo *ti)
SpriteID ground = GetCustomRailSprite(rti, ti->tile, RTSG_GROUND);
switch (GetRailDepotDirection(ti->tile)) {
case DIAGDIR_NE: if (!IsInvisibilitySet(TO_BUILDINGS)) break; // else FALL THROUGH
case DIAGDIR_SW: DrawGroundSprite(ground + RTO_X, PAL_NONE); break;
case DIAGDIR_NW: if (!IsInvisibilitySet(TO_BUILDINGS)) break; // else FALL THROUGH
case DIAGDIR_SE: DrawGroundSprite(ground + RTO_Y, PAL_NONE); break;
default: break;
case DIAGDIR_NE:
if (!IsInvisibilitySet(TO_BUILDINGS)) break;
FALLTHROUGH;
case DIAGDIR_SW:
DrawGroundSprite(ground + RTO_X, PAL_NONE);
break;
case DIAGDIR_NW:
if (!IsInvisibilitySet(TO_BUILDINGS)) break;
FALLTHROUGH;
case DIAGDIR_SE:
DrawGroundSprite(ground + RTO_Y, PAL_NONE);
break;
default:
break;
}
if (_settings_client.gui.show_track_reservation && HasDepotReservation(ti->tile)) {
SpriteID overlay = GetCustomRailSprite(rti, ti->tile, RTSG_OVERLAY);
switch (GetRailDepotDirection(ti->tile)) {
case DIAGDIR_NE: if (!IsInvisibilitySet(TO_BUILDINGS)) break; // else FALL THROUGH
case DIAGDIR_SW: DrawGroundSprite(overlay + RTO_X, PALETTE_CRASH); break;
case DIAGDIR_NW: if (!IsInvisibilitySet(TO_BUILDINGS)) break; // else FALL THROUGH
case DIAGDIR_SE: DrawGroundSprite(overlay + RTO_Y, PALETTE_CRASH); break;
default: break;
case DIAGDIR_NE:
if (!IsInvisibilitySet(TO_BUILDINGS)) break;
FALLTHROUGH;
case DIAGDIR_SW:
DrawGroundSprite(overlay + RTO_X, PALETTE_CRASH);
break;
case DIAGDIR_NW:
if (!IsInvisibilitySet(TO_BUILDINGS)) break;
FALLTHROUGH;
case DIAGDIR_SE:
DrawGroundSprite(overlay + RTO_Y, PALETTE_CRASH);
break;
default:
break;
}
}
} else {
/* PBS debugging, draw reserved tracks darker */
if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasDepotReservation(ti->tile)) {
switch (GetRailDepotDirection(ti->tile)) {
case DIAGDIR_NE: if (!IsInvisibilitySet(TO_BUILDINGS)) break; // else FALL THROUGH
case DIAGDIR_SW: DrawGroundSprite(rti->base_sprites.single_x, PALETTE_CRASH); break;
case DIAGDIR_NW: if (!IsInvisibilitySet(TO_BUILDINGS)) break; // else FALL THROUGH
case DIAGDIR_SE: DrawGroundSprite(rti->base_sprites.single_y, PALETTE_CRASH); break;
default: break;
case DIAGDIR_NE:
if (!IsInvisibilitySet(TO_BUILDINGS)) break;
FALLTHROUGH;
case DIAGDIR_SW:
DrawGroundSprite(rti->base_sprites.single_x, PALETTE_CRASH);
break;
case DIAGDIR_NW:
if (!IsInvisibilitySet(TO_BUILDINGS)) break;
FALLTHROUGH;
case DIAGDIR_SE:
DrawGroundSprite(rti->base_sprites.single_y, PALETTE_CRASH);
break;
default:
break;
}
}
}