diff options
author | Charles Pigott <charlespigott@googlemail.com> | 2020-12-27 10:44:22 +0000 |
---|---|---|
committer | Charles Pigott <charlespigott@googlemail.com> | 2020-12-27 10:55:42 +0000 |
commit | 860c270c73048b4930ac8cbebcd60be746eb9782 (patch) | |
tree | a88a8acb208cf426ae8fac05dda202c57b59426a /src/table | |
parent | 395a5d9991b500c681ff384f8d3b4e153e687abb (diff) | |
download | openttd-860c270c73048b4930ac8cbebcd60be746eb9782.tar.xz |
Codechange: Replace assert_compile macro with static_assert
Diffstat (limited to 'src/table')
-rw-r--r-- | src/table/airport_defaults.h | 2 | ||||
-rw-r--r-- | src/table/airporttiles.h | 2 | ||||
-rw-r--r-- | src/table/newgrf_debug_data.h | 2 | ||||
-rw-r--r-- | src/table/pricebase.h | 2 | ||||
-rw-r--r-- | src/table/sprites.h | 10 | ||||
-rw-r--r-- | src/table/station_land.h | 2 | ||||
-rw-r--r-- | src/table/town_land.h | 4 | ||||
-rw-r--r-- | src/table/train_cmd.h | 6 |
8 files changed, 15 insertions, 15 deletions
diff --git a/src/table/airport_defaults.h b/src/table/airport_defaults.h index ec30874f7..dce71843a 100644 --- a/src/table/airport_defaults.h +++ b/src/table/airport_defaults.h @@ -406,7 +406,7 @@ extern const AirportSpec _origin_airport_specs[] = { AS_GENERIC(&_airportfta_oilrig, nullptr, _default_airports_rotation, 0, nullptr, 0, 1, 1, 0, 4, 0, 0, 0, ATP_TTDP_OILRIG, APC_HELIPORT, STR_NULL, 0, false), }; -assert_compile(NEW_AIRPORT_OFFSET == lengthof(_origin_airport_specs)); +static_assert(NEW_AIRPORT_OFFSET == lengthof(_origin_airport_specs)); const AirportSpec AirportSpec::dummy = AS_GENERIC(&_airportfta_dummy, nullptr, _default_airports_rotation, 0, nullptr, 0, 0, 0, 0, 0, MIN_YEAR, MIN_YEAR, 0, ATP_TTDP_LARGE, APC_BEGIN, STR_NULL, 0, false); diff --git a/src/table/airporttiles.h b/src/table/airporttiles.h index d4fb3d968..0393cf7a5 100644 --- a/src/table/airporttiles.h +++ b/src/table/airporttiles.h @@ -104,7 +104,7 @@ static const AirportTileSpec _origin_airporttile_specs[] = { AT(3, 1), // APT_GRASS_FENCE_NE_FLAG_2 }; -assert_compile(NEW_AIRPORTTILE_OFFSET == lengthof(_origin_airporttile_specs)); +static_assert(NEW_AIRPORTTILE_OFFSET == lengthof(_origin_airporttile_specs)); #undef AT_NOANIM #undef AT diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index d14415051..4e5abaff5 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -620,4 +620,4 @@ static const NIFeature * const _nifeatures[] = { &_nif_tramtype, // GSF_TRAMTYPES &_nif_town, // GSF_FAKE_TOWNS }; -assert_compile(lengthof(_nifeatures) == GSF_FAKE_END); +static_assert(lengthof(_nifeatures) == GSF_FAKE_END); diff --git a/src/table/pricebase.h b/src/table/pricebase.h index 5051254a3..27af6a370 100644 --- a/src/table/pricebase.h +++ b/src/table/pricebase.h @@ -80,4 +80,4 @@ extern const PriceBaseSpec _price_base_specs[] = { { 100, PCAT_RUNNING, GSF_END, PR_STATION_VALUE }, ///< PR_INFRASTRUCTURE_STATION { 5000, PCAT_RUNNING, GSF_END, PR_BUILD_STATION_AIRPORT}, ///< PR_INFRASTRUCTURE_AIRPORT }; -assert_compile(lengthof(_price_base_specs) == PR_END); +static_assert(lengthof(_price_base_specs) == PR_END); diff --git a/src/table/sprites.h b/src/table/sprites.h index 64f628e5d..7d9f980ef 100644 --- a/src/table/sprites.h +++ b/src/table/sprites.h @@ -1545,11 +1545,11 @@ enum SpriteMasks { PALETTE_MASK = MAX_PALETTES - 1, ///< The mask for the auxiliary sprite (the one that takes care of recolouring) }; -assert_compile( (1 << TRANSPARENT_BIT & SPRITE_MASK) == 0 ); -assert_compile( (1 << RECOLOUR_BIT & SPRITE_MASK) == 0 ); -assert_compile( TRANSPARENT_BIT != RECOLOUR_BIT ); -assert_compile( (1 << TRANSPARENT_BIT & PALETTE_MASK) == 0); -assert_compile( (1 << RECOLOUR_BIT & PALETTE_MASK) == 0 ); +static_assert( (1 << TRANSPARENT_BIT & SPRITE_MASK) == 0 ); +static_assert( (1 << RECOLOUR_BIT & SPRITE_MASK) == 0 ); +static_assert( TRANSPARENT_BIT != RECOLOUR_BIT ); +static_assert( (1 << TRANSPARENT_BIT & PALETTE_MASK) == 0); +static_assert( (1 << RECOLOUR_BIT & PALETTE_MASK) == 0 ); static const PaletteID PAL_NONE = 0; diff --git a/src/table/station_land.h b/src/table/station_land.h index 6b4b2267a..8429914f3 100644 --- a/src/table/station_land.h +++ b/src/table/station_land.h @@ -988,7 +988,7 @@ static const DrawTileSprites _station_display_datas_waypoint[] = { /* Default waypoint is also drawn as fallback for NewGRF waypoints. * As these are drawn/build like stations, they may use the same number of layouts. */ -assert_compile(lengthof(_station_display_datas_rail) == lengthof(_station_display_datas_waypoint)); +static_assert(lengthof(_station_display_datas_rail) == lengthof(_station_display_datas_waypoint)); static const DrawTileSprites * const _station_display_datas[] = { _station_display_datas_rail, diff --git a/src/table/town_land.h b/src/table/town_land.h index 80a181baa..92292f620 100644 --- a/src/table/town_land.h +++ b/src/table/town_land.h @@ -1788,7 +1788,7 @@ static const DrawBuildingsTileStruct _town_draw_tile_data[] = { }; #undef M /** Make sure we have the right number of elements: 4 variants * 4 build stages for each house */ -assert_compile(lengthof(_town_draw_tile_data) == (NEW_HOUSE_OFFSET) * 4 * 4); +static_assert(lengthof(_town_draw_tile_data) == (NEW_HOUSE_OFFSET) * 4 * 4); /** * Describes the data that defines each house in the game @@ -2276,4 +2276,4 @@ static const HouseSpec _original_house_specs[] = { #undef MS /** Make sure we have the right number of elements: one entry for each house */ -assert_compile(lengthof(_original_house_specs) == NEW_HOUSE_OFFSET); +static_assert(lengthof(_original_house_specs) == NEW_HOUSE_OFFSET); diff --git a/src/table/train_cmd.h b/src/table/train_cmd.h index cc53582f8..f9419990b 100644 --- a/src/table/train_cmd.h +++ b/src/table/train_cmd.h @@ -63,6 +63,6 @@ static const byte _wagon_full_adder[] = { 32, 32 }; -assert_compile(lengthof(_engine_sprite_base) == lengthof(_engine_sprite_and)); -assert_compile(lengthof(_engine_sprite_base) == lengthof(_engine_sprite_add)); -assert_compile(lengthof(_engine_sprite_base) == lengthof(_wagon_full_adder)); +static_assert(lengthof(_engine_sprite_base) == lengthof(_engine_sprite_and)); +static_assert(lengthof(_engine_sprite_base) == lengthof(_engine_sprite_add)); +static_assert(lengthof(_engine_sprite_base) == lengthof(_wagon_full_adder)); |