diff --git a/src/cargotype.h b/src/cargotype.h index ad009cc9a9..54e7f2a1ca 100644 --- a/src/cargotype.h +++ b/src/cargotype.h @@ -192,7 +192,7 @@ struct CargoSpec { static IterateWrapper Iterate(size_t from = 0) { return IterateWrapper(from); } /** List of cargo specs for each Town Product Effect. */ - static inline EnumClassIndexContainer, to_underlying(TownProductionEffect::End)>, TownProductionEffect> town_production_cargoes{}; + static inline EnumIndexArray, TownProductionEffect, TownProductionEffect::End> town_production_cargoes{}; private: static CargoSpec array[NUM_CARGO]; ///< Array holding all CargoSpecs diff --git a/src/command.cpp b/src/command.cpp index 28971e005c..197390892b 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -84,7 +84,7 @@ inline constexpr CommandInfo CommandFromTrait() noexcept { return { T::name, T:: template inline constexpr auto MakeCommandsFromTraits(std::integer_sequence) noexcept { - return EnumClassIndexContainer, Commands>{{{ CommandFromTrait(i)>>()... }}}; + return EnumIndexArray(sizeof...(i))>{{{ CommandFromTrait(i)>>()... }}}; } /** diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 07bb136bcb..8333149346 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -470,7 +470,7 @@ bad_town_name:; } /** Sorting weights for the company colours. */ -static const EnumClassIndexContainer, Colours> _colour_sort{2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 2, 3, 1, 1, 1}; +static const EnumIndexArray _colour_sort{2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 2, 3, 1, 1, 1}; /** Similar colours, so we can try to prevent same coloured companies. */ static const std::initializer_list _similar_colour[to_underlying(Colours::End)] = { {Colours::Blue, Colours::LightBlue }, // Colours::DarkBlue diff --git a/src/core/enum_type.hpp b/src/core/enum_type.hpp index b8d4d8889b..1d2bdb346a 100644 --- a/src/core/enum_type.hpp +++ b/src/core/enum_type.hpp @@ -259,4 +259,13 @@ public: Container::const_reference operator[](const Index &pos) const { return this->Container::operator[](to_underlying(pos)); } }; +/** + * A typedef for EnumClassIndexContainer using std::array as the backing container type. + * @tparam T std::array value type. + * @tparam Index The enum class to use for indexing. + * @tparam N The std::array size. + */ +template +using EnumIndexArray = EnumClassIndexContainer, Index>; + #endif /* ENUM_TYPE_HPP */ diff --git a/src/economy.cpp b/src/economy.cpp index 5b0f13ed6f..1ae0d7d8d3 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -88,7 +88,7 @@ typedef std::vector SmallIndustryList; /** * Score info, values used for computing the detailed performance rating. */ -const EnumClassIndexContainer, ScoreID> _score_info = { +const EnumIndexArray _score_info = { ScoreInfo(100, 120), // ScoreID::Vehicles ScoreInfo(100, 80), // ScoreID::Stations ScoreInfo(100, 10000), // ScoreID::MinProfit @@ -101,7 +101,7 @@ const EnumClassIndexContainer ScoreInfo(0, 0), // ScoreID::Total }; -TypedIndexContainer, ScoreID>, MAX_COMPANIES>, CompanyID> _score_part; +TypedIndexContainer, MAX_COMPANIES>, CompanyID> _score_part; Economy _economy; Prices _price; static PriceMultipliers _price_base_multiplier; diff --git a/src/economy_func.h b/src/economy_func.h index 97adfe9708..4995bd5926 100644 --- a/src/economy_func.h +++ b/src/economy_func.h @@ -22,8 +22,8 @@ void ResetPriceBaseMultipliers(); void SetPriceBaseMultiplier(Price price, int factor); -extern const EnumClassIndexContainer, ScoreID> _score_info; -extern TypedIndexContainer, ScoreID>, MAX_COMPANIES>, CompanyID> _score_part; +extern const EnumIndexArray _score_info; +extern TypedIndexContainer, MAX_COMPANIES>, CompanyID> _score_part; extern Economy _economy; /** Prices and also the fractional part. */ extern Prices _price; diff --git a/src/economy_type.h b/src/economy_type.h index 72131382ec..3cd9bdd3f0 100644 --- a/src/economy_type.h +++ b/src/economy_type.h @@ -168,8 +168,8 @@ enum class Price : uint8_t { }; DECLARE_INCREMENT_DECREMENT_OPERATORS(Price) -using Prices = EnumClassIndexContainer, Price>; ///< Prices of everything. @see Price -using PriceMultipliers = EnumClassIndexContainer, Price>; +using Prices = EnumIndexArray; ///< Prices of everything. @see Price +using PriceMultipliers = EnumIndexArray; /** Types of expenses. */ enum ExpensesType : uint8_t { diff --git a/src/fileio.cpp b/src/fileio.cpp index 3a770fcd49..a549a34070 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -36,7 +36,7 @@ extern std::string _config_file; extern std::string _highscore_file; /** Subdirectory names. */ -static const EnumClassIndexContainer, Subdirectory> _subdirs = { +static const EnumIndexArray _subdirs = { "", "save" PATHSEP, "save" PATHSEP "autosave" PATHSEP, @@ -62,12 +62,12 @@ static const EnumClassIndexContainer, Searchpath> _searchpaths; +EnumIndexArray _searchpaths; std::vector _valid_searchpaths; /** List of tar files found in each subdirectory. */ -EnumClassIndexContainer, Subdirectory> _tar_list; +EnumIndexArray _tar_list; /** List of files within tar files found in each subdirectory. */ -EnumClassIndexContainer, Subdirectory> _tar_filelist; +EnumIndexArray _tar_filelist; /** * Checks whether the given search path is a valid search path diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 4255872464..38f1f97f55 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -303,7 +303,7 @@ static constexpr std::initializer_list _nested_save_dialog_widgets }; /** Text colours of #DetailedFileType fios entries in the window. */ -static const EnumClassIndexContainer, DetailedFileType> _fios_colours = { +static const EnumIndexArray _fios_colours = { TC_LIGHT_BROWN, // DetailedFileType::OldGameFile TC_ORANGE, // DetailedFileType::GameFile TC_YELLOW, // DetailedFileType::HeightmapBmp diff --git a/src/fontcache.cpp b/src/fontcache.cpp index 8423bc4197..c43124ac57 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -21,9 +21,9 @@ #include "safeguards.h" /** Default unscaled heights for the different sizes of fonts. */ -/* static */ const EnumClassIndexContainer, FontSize> FontCache::DEFAULT_FONT_HEIGHT{10, 6, 18, 10}; +/* static */ const EnumIndexArray FontCache::DEFAULT_FONT_HEIGHT{10, 6, 18, 10}; /** Default unscaled ascenders for the different sizes of fonts. */ -/* static */ const EnumClassIndexContainer, FontSize> FontCache::DEFAULT_FONT_ASCENDER{8, 5, 15, 8}; +/* static */ const EnumIndexArray FontCache::DEFAULT_FONT_ASCENDER{8, 5, 15, 8}; FontCacheSettings _fcsettings; @@ -91,7 +91,7 @@ int GetCharacterHeight(FontSize size) } -/* static */ EnumClassIndexContainer, to_underlying(FontSize::End)>, FontSize> FontCache::caches{}; +/* static */ EnumIndexArray, FontSize, FontSize::End> FontCache::caches{}; /** * Initialise font caches with the base sprite font cache for all sizes. diff --git a/src/fontcache.h b/src/fontcache.h index fb60190367..d7b683d80c 100644 --- a/src/fontcache.h +++ b/src/fontcache.h @@ -22,7 +22,7 @@ static const GlyphID SPRITE_GLYPH = 1U << 30; /** Font cache for basic fonts. */ class FontCache { protected: - static EnumClassIndexContainer, to_underlying(FontSize::End)>, FontSize> caches; ///< All the font caches. + static EnumIndexArray, FontSize, FontSize::End> caches; ///< All the font caches. std::unique_ptr parent; ///< The parent of this font cache. const FontSize fs; ///< The size of the font. int height = 0; ///< The height of the font. @@ -42,9 +42,9 @@ public: static void ClearFontCaches(FontSizes fontsizes); /** Default unscaled font heights. */ - static const EnumClassIndexContainer, FontSize> DEFAULT_FONT_HEIGHT; + static const EnumIndexArray DEFAULT_FONT_HEIGHT; /** Default unscaled font ascenders. */ - static const EnumClassIndexContainer, FontSize> DEFAULT_FONT_ASCENDER; + static const EnumIndexArray DEFAULT_FONT_ASCENDER; static int GetDefaultFontHeight(FontSize fs); diff --git a/src/fontcache/spritefontcache.cpp b/src/fontcache/spritefontcache.cpp index 068d8b2af4..d9723ddae5 100644 --- a/src/fontcache/spritefontcache.cpp +++ b/src/fontcache/spritefontcache.cpp @@ -33,7 +33,7 @@ static int ScaleFontTrad(int value) return UnScaleByZoom(value * ZOOM_BASE, _font_zoom); } -static EnumClassIndexContainer, to_underlying(FontSize::End)>, FontSize> _char_maps{}; ///< Glyph map for each font size. +static EnumIndexArray, FontSize, FontSize::End> _char_maps{}; ///< Glyph map for each font size. /** * Get SpriteID associated with a character. diff --git a/src/gfx.cpp b/src/gfx.cpp index 6404380dac..5fee3e8bb7 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -51,7 +51,7 @@ SwitchMode _switch_mode; ///< The next mainloop command. PauseModes _pause_mode; GameSessionStats _game_session_stats; ///< Statistics about the current session. -static EnumClassIndexContainer, to_underlying(FontSize::End)>, FontSize> _stringwidth_table; ///< Cache containing width of often used characters. @see GetCharacterWidth() +static EnumIndexArray, FontSize, FontSize::End> _stringwidth_table; ///< Cache containing width of often used characters. @see GetCharacterWidth() DrawPixelInfo *_cur_dpi; static void GfxMainBlitterViewport(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub = nullptr, SpriteID sprite_id = SPR_CURSOR_MOUSE); diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp index c0c1b9a8db..1a3fdb8b8c 100644 --- a/src/gfx_layout.cpp +++ b/src/gfx_layout.cpp @@ -38,7 +38,7 @@ std::unique_ptr Layouter::linecache; /** Cache of Font instances. */ -EnumClassIndexContainer, FontSize> Layouter::fonts; +EnumIndexArray Layouter::fonts; /** diff --git a/src/gfx_layout.h b/src/gfx_layout.h index f99005e586..ed760ea71c 100644 --- a/src/gfx_layout.h +++ b/src/gfx_layout.h @@ -279,7 +279,7 @@ private: static LineCacheItem &GetCachedParagraphLayout(std::string_view str, const FontState &state); using FontColourMap = std::map>; - static EnumClassIndexContainer, FontSize> fonts; ///< The colour mapping of each of the fonts. + static EnumIndexArray fonts; ///< The colour mapping of each of the fonts. public: static Font *GetFont(FontSize size, TextColour colour); diff --git a/src/landscape.cpp b/src/landscape.cpp index aebd39ebdc..3c391639d4 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -66,7 +66,7 @@ extern const TileTypeProcs * @ingroup TileCallbackGroup * @see TileType */ -const EnumClassIndexContainer, TileType> _tile_type_procs = { +const EnumIndexArray _tile_type_procs = { &_tile_type_clear_procs, // Callback functions for TileType::Clear tiles &_tile_type_rail_procs, // Callback functions for TileType::Railway tiles &_tile_type_road_procs, // Callback functions for TileType::Road tiles diff --git a/src/network/network_command.cpp b/src/network/network_command.cpp index f2dfc0c8a0..27bb05f4dc 100644 --- a/src/network/network_command.cpp +++ b/src/network/network_command.cpp @@ -167,7 +167,7 @@ constexpr UnpackDispatchT MakeUnpackNetworkCommand(std::index_sequence) no template inline constexpr auto MakeDispatchTable(std::integer_sequence, std::index_sequence) noexcept { - return EnumClassIndexContainer, Commands>{{{ { &SanitizeCmdStrings(i)>, &NetworkReplaceCommandClientId(i)>, MakeUnpackNetworkCommand(i)>(std::make_index_sequence<_callback_tuple_size>{}) }... }}}; + return EnumIndexArray(sizeof...(i))>{{{ { &SanitizeCmdStrings(i)>, &NetworkReplaceCommandClientId(i)>, MakeUnpackNetworkCommand(i)>(std::make_index_sequence<_callback_tuple_size>{}) }... }}}; } /** Command dispatch table. */ static constexpr auto _cmd_dispatch = MakeDispatchTable(std::make_integer_sequence, to_underlying(Commands::End)>{}, std::make_index_sequence<_callback_tuple_size>{}); diff --git a/src/network/network_type.h b/src/network/network_type.h index ea9d803fda..92db79b79b 100644 --- a/src/network/network_type.h +++ b/src/network/network_type.h @@ -55,7 +55,7 @@ using AdminID = PoolID; /** Simple calculated statistics of a company */ struct NetworkCompanyStats { /** Array indexed by NetworkVehicleType. */ - using NetworkVehicleTypeArray = EnumClassIndexContainer, NetworkVehicleType>; + using NetworkVehicleTypeArray = EnumIndexArray; NetworkVehicleTypeArray num_vehicle; ///< How many vehicles are there of this type? NetworkVehicleTypeArray num_station; ///< How many stations are there of this type? }; diff --git a/src/newgrf/newgrf_act0.cpp b/src/newgrf/newgrf_act0.cpp index 33a454cf5a..f31eb8baf9 100644 --- a/src/newgrf/newgrf_act0.cpp +++ b/src/newgrf/newgrf_act0.cpp @@ -164,7 +164,7 @@ struct InvokeGrfChangeInfoHandler { using Invoker = ChangeInfoResult(*)(uint first, uint last, int prop, ByteReader &buf, GrfLoadingStage stage); /** List of invoke handlers for each feature. */ - static constexpr EnumClassIndexContainer, GrfSpecFeature> funcs { // Must be listed in feature order. + static constexpr EnumIndexArray funcs { // Must be listed in feature order. Invoke, Invoke, Invoke, Invoke, Invoke, Invoke, Invoke, Invoke, Invoke, Invoke, Invoke, Invoke, diff --git a/src/newgrf_badge_config.cpp b/src/newgrf_badge_config.cpp index fb88a458b1..824d46e6cc 100644 --- a/src/newgrf_badge_config.cpp +++ b/src/newgrf_badge_config.cpp @@ -24,13 +24,13 @@ class BadgeClassConfig { public: static inline const BadgeClassConfigItem EMPTY_CONFIG_ITEM{}; - EnumClassIndexContainer, to_underlying(GrfSpecFeature::End)>, GrfSpecFeature> features = {}; + EnumIndexArray, GrfSpecFeature, GrfSpecFeature::End> features = {}; static constexpr GrfSpecFeatures CONFIGURABLE_FEATURES = { GrfSpecFeature::Trains, GrfSpecFeature::RoadVehicles, GrfSpecFeature::Ships, GrfSpecFeature::Aircraft, GrfSpecFeature::Stations, GrfSpecFeature::Houses, GrfSpecFeature::Objects, GrfSpecFeature::RoadStops, }; - static inline const EnumClassIndexContainer, GrfSpecFeature> sections = { + static inline const EnumIndexArray sections = { "badges_trains", // GrfSpecFeature::Trains "badges_roadvehicles", // GrfSpecFeature::RoadVehicles "badges_ships", // GrfSpecFeature::Ships diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 8e6f88ef6c..ebf3b06162 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -258,7 +258,7 @@ static inline const NIHelper &GetFeatureHelper(uint window_number) /** Window used for inspecting NewGRFs. */ struct NewGRFInspectWindow : Window { /** The value for the variable 60 parameters. */ - static inline EnumClassIndexContainer, to_underlying(GrfSpecFeature::FakeEnd)>, GrfSpecFeature> var60params{}; + static inline EnumIndexArray, GrfSpecFeature, GrfSpecFeature::FakeEnd> var60params{}; /** GRFID of the caller of this window, 0 if it has no caller. */ uint32_t caller_grfid = 0; diff --git a/src/newgrf_generic.cpp b/src/newgrf_generic.cpp index 9638b6c945..40091db34c 100644 --- a/src/newgrf_generic.cpp +++ b/src/newgrf_generic.cpp @@ -86,7 +86,7 @@ struct GenericCallback { typedef std::list GenericCallbackList; /** Generic callbacks for each feature. */ -static EnumClassIndexContainer, GrfSpecFeature> _gcl{}; +static EnumIndexArray _gcl{}; /** diff --git a/src/os/macosx/macos.mm b/src/os/macosx/macos.mm index 493b0f119d..702d93e97b 100644 --- a/src/os/macosx/macos.mm +++ b/src/os/macosx/macos.mm @@ -126,7 +126,7 @@ std::optional GetClipboardContents() */ void CocoaSetApplicationBundleDir() { - extern EnumClassIndexContainer, Searchpath> _searchpaths; + extern EnumIndexArray _searchpaths; char tmp[MAXPATHLEN]; CFAutoRelease url(CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle())); diff --git a/src/os/macosx/string_osx.cpp b/src/os/macosx/string_osx.cpp index 638d4d1234..09ed0b4458 100644 --- a/src/os/macosx/string_osx.cpp +++ b/src/os/macosx/string_osx.cpp @@ -24,7 +24,7 @@ /** Cached current locale. */ static CFAutoRelease _osx_locale; /** CoreText cache for font information, cleared when OTTD changes fonts. */ -static EnumClassIndexContainer, to_underlying(FontSize::End)>, FontSize> _font_cache; +static EnumIndexArray, FontSize, FontSize::End> _font_cache; /** diff --git a/src/os/windows/string_uniscribe.cpp b/src/os/windows/string_uniscribe.cpp index 886d1b62ec..6bda6f40e0 100644 --- a/src/os/windows/string_uniscribe.cpp +++ b/src/os/windows/string_uniscribe.cpp @@ -29,7 +29,7 @@ /** Uniscribe cache for internal font information, cleared when OTTD changes fonts. */ -static EnumClassIndexContainer, FontSize> _script_cache; +static EnumIndexArray _script_cache; /** * Contains all information about a run of characters. A run are consecutive diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index 0d2e45fc79..8b8ed358a0 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -248,7 +248,7 @@ extern std::string _config_file; void DetermineBasePaths(std::string_view exe) { - extern EnumClassIndexContainer, Searchpath> _searchpaths; + extern EnumIndexArray _searchpaths; wchar_t path[MAX_PATH]; #ifdef WITH_PERSONAL_DIR diff --git a/src/rail.h b/src/rail.h index 53ded62b6d..8ff359310a 100644 --- a/src/rail.h +++ b/src/rail.h @@ -262,12 +262,12 @@ public: /** * NewGRF providing the Action3 for the railtype. nullptr if not available. */ - EnumClassIndexContainer, RailSpriteType> grffile{}; + EnumIndexArray grffile{}; /** * Sprite groups for resolving sprites */ - EnumClassIndexContainer, RailSpriteType> group{}; + EnumIndexArray group{}; std::vector badges; diff --git a/src/road.h b/src/road.h index 3be8bab573..712f6a5b8f 100644 --- a/src/road.h +++ b/src/road.h @@ -158,12 +158,12 @@ public: /** * NewGRF providing the Action3 for the roadtype. nullptr if not available. */ - EnumClassIndexContainer, RoadSpriteType> grffile{}; + EnumIndexArray grffile{}; /** * Sprite groups for resolving sprites */ - EnumClassIndexContainer, RoadSpriteType> group{}; + EnumIndexArray group{}; std::vector badges; diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 18d57b24af..35c597d84c 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2451,8 +2451,8 @@ static CommandCost RemoveGenericRoadStop(DoCommandFlags flags, const TileArea &r /* Save information on to-be-restored roads before the stop is removed. */ RoadBits road_bits{}; - EnumClassIndexContainer, RoadTramType> road_type{INVALID_ROADTYPE, INVALID_ROADTYPE}; - EnumClassIndexContainer, RoadTramType> road_owner{OWNER_NONE, OWNER_NONE}; + EnumIndexArray road_type{INVALID_ROADTYPE, INVALID_ROADTYPE}; + EnumIndexArray road_owner{OWNER_NONE, OWNER_NONE}; if (IsDriveThroughStopTile(cur_tile)) { for (RoadTramType rtt : ROADTRAMTYPES_ALL) { road_type[rtt] = GetRoadType(cur_tile, rtt); diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 4fb27b1a15..4e26c12062 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -721,7 +721,7 @@ static const NIFeature _nif_roadstop = { }; /** Table with all NIFeatures. */ -static const EnumClassIndexContainer, GrfSpecFeature> _nifeatures{ +static const EnumIndexArray _nifeatures{ &_nif_vehicle, // GrfSpecFeature::Trains &_nif_vehicle, // GrfSpecFeature::RoadVehicles &_nif_vehicle, // GrfSpecFeature::Ships diff --git a/src/table/pricebase.h b/src/table/pricebase.h index bb2c939506..b2eaf45115 100644 --- a/src/table/pricebase.h +++ b/src/table/pricebase.h @@ -7,7 +7,7 @@ /** @file pricebase.h Table of all default price bases. */ -static const EnumClassIndexContainer, Price> _price_base_specs = { +static const EnumIndexArray _price_base_specs = { PriceBaseSpec(100, PCAT_NONE, GrfSpecFeature::End, Price::Invalid), // Price::StationValue PriceBaseSpec(100, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildRail PriceBaseSpec(95, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildRoad diff --git a/src/table/roadveh_movement.h b/src/table/roadveh_movement.h index 749bd0d055..ff5ad7c01f 100644 --- a/src/table/roadveh_movement.h +++ b/src/table/roadveh_movement.h @@ -1479,7 +1479,7 @@ static const RoadDriveEntry * const _road_tram_drive_data[] = { }; /** Road drive data for all \c RoadTramTypes */ -static const EnumClassIndexContainer, RoadTramType> _road_drive_data{ +static const EnumIndexArray _road_drive_data{ _road_road_drive_data, _road_tram_drive_data, }; diff --git a/src/tar_type.h b/src/tar_type.h index ae87c504bd..eb374d2a11 100644 --- a/src/tar_type.h +++ b/src/tar_type.h @@ -21,7 +21,7 @@ struct TarFileListEntry { using TarList = std::map>; ///< Map of tar file to tar directory. using TarFileList = std::map> ; -extern EnumClassIndexContainer, Subdirectory> _tar_list; -extern EnumClassIndexContainer, Subdirectory> _tar_filelist; +extern EnumIndexArray _tar_list; +extern EnumIndexArray _tar_filelist; #endif /* TAR_TYPE_H */ diff --git a/src/tile_cmd.h b/src/tile_cmd.h index bcd00d79e1..ab58213cb1 100644 --- a/src/tile_cmd.h +++ b/src/tile_cmd.h @@ -228,7 +228,7 @@ struct TileTypeProcs { CheckBuildAboveProc *check_build_above_proc = nullptr; ///< Called to check whether a bridge can be build above. }; -extern const EnumClassIndexContainer, TileType> _tile_type_procs; +extern const EnumIndexArray _tile_type_procs; TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, RoadTramType sub_mode, DiagDirection side = INVALID_DIAGDIR); VehicleEnterTileStates VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y); diff --git a/src/town.h b/src/town.h index 4cc7403460..af7ec690ef 100644 --- a/src/town.h +++ b/src/town.h @@ -129,8 +129,8 @@ struct Town : TownPool::PoolItem<&_town_pool> { SuppliedCargoes supplied{}; ///< Cargo statistics about supplied cargo. AcceptedCargoes accepted{}; ///< Cargo statistics about accepted cargo. - EnumClassIndexContainer, to_underlying(TownAcceptanceEffect::End)>, TownAcceptanceEffect> received{}; ///< Cargo statistics about received cargotypes. - EnumClassIndexContainer, TownAcceptanceEffect> goal{}; ///< Amount of cargo required for the town to grow. + EnumIndexArray, TownAcceptanceEffect, TownAcceptanceEffect::End> received{}; ///< Cargo statistics about received cargotypes. + EnumIndexArray goal{}; ///< Amount of cargo required for the town to grow. ValidHistoryMask valid_history = 0; ///< Mask of valid history records. EncodedString text{}; ///< General text with additional information. diff --git a/src/vehicle_type.h b/src/vehicle_type.h index 9d4511c77f..a1f4c15ed7 100644 --- a/src/vehicle_type.h +++ b/src/vehicle_type.h @@ -96,6 +96,6 @@ using VehicleRandomTriggers = EnumBitSet; * @tparam Tend the number of elements in the array. */ template -using VehicleTypeIndexArray = EnumClassIndexContainer, VehicleType>; +using VehicleTypeIndexArray = EnumIndexArray; #endif /* VEHICLE_TYPE_H */