From 398418b8fa23ab59f5fc027a7dd6aeba9da4d7bb Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 13 May 2010 09:44:44 +0000 Subject: (svn r19812) -Codechange: give some unnamed enums a name or, in case they consisted of unrelated values use static const (u)int --- src/airport.h | 6 +++--- src/bridge.h | 4 +--- src/build_vehicle_gui.cpp | 6 ++---- src/command_type.h | 6 +++--- src/company_type.h | 14 +++++--------- src/console_internal.h | 6 ++---- src/currency.h | 10 ++++------ src/date_type.h | 37 ++++++++++++++++++------------------- src/economy_type.h | 8 +++----- src/engine_type.h | 14 ++++++-------- src/fios.h | 4 ++-- src/genworld.h | 9 ++++----- src/gfx_func.h | 6 ++---- src/graph_gui.cpp | 12 +++++------- src/group_type.h | 14 ++++++-------- src/heightmap.h | 2 +- src/house.h | 18 ++++++++---------- src/industry_map.h | 2 +- src/industry_type.h | 20 ++++++++++---------- src/industrytype.h | 2 +- src/landscape.h | 6 ++---- src/map_type.h | 10 ++++------ src/newgrf.h | 2 +- src/newgrf_callbacks.h | 6 ++---- src/newgrf_engine.h | 8 +++----- src/openttd.h | 2 +- src/order_type.h | 2 +- src/pathfinder/npf/aystar.h | 6 ++---- src/roadveh.h | 34 ++++++++++++++++------------------ src/saveload/map_sl.cpp | 4 +--- src/saveload/oldloader.cpp | 6 ++---- src/saveload/oldloader.h | 6 ++---- src/saveload/saveload.h | 6 +----- src/signs_type.h | 8 +++----- src/station_map.h | 6 ++---- src/station_type.h | 6 ++---- src/strings_type.h | 9 +++------ src/subsidy.cpp | 2 +- src/subsidy_base.h | 14 ++++++-------- src/table/build_industry.h | 2 +- src/table/elrail_data.h | 14 +++++--------- src/table/landscape_sprite.h | 4 +--- src/table/palettes.h | 12 +++++------- src/table/unicode.h | 6 ++---- src/town.h | 2 +- src/town_gui.cpp | 4 +--- src/town_type.h | 8 +++----- src/tree_map.h | 12 +++++------- src/vehicle_gui.h | 2 +- src/vehicle_type.h | 8 +++----- src/viewport_type.h | 6 ++---- src/widget_type.h | 4 +--- 52 files changed, 173 insertions(+), 254 deletions(-) (limited to 'src') diff --git a/src/airport.h b/src/airport.h index 2aaddfbc1..7a0cdf54a 100644 --- a/src/airport.h +++ b/src/airport.h @@ -26,7 +26,7 @@ enum { }; /** Airport types */ -enum { +enum AirportTypes { AT_SMALL = 0, AT_LARGE = 1, AT_HELIPORT = 2, @@ -43,7 +43,7 @@ enum { AT_DUMMY = 255 }; -enum { +enum AirportMovingDataFlags { AMED_NOSPDCLAMP = 1 << 0, AMED_TAKEOFF = 1 << 1, AMED_SLOWTURN = 1 << 2, @@ -56,7 +56,7 @@ enum { }; /* Movement States on Airports (headings target) */ -enum { +enum AirportMovementStates { TO_ALL = 0, HANGAR = 1, TERM1 = 2, diff --git a/src/bridge.h b/src/bridge.h index 052313e24..771833347 100644 --- a/src/bridge.h +++ b/src/bridge.h @@ -32,9 +32,7 @@ enum BridgePieces { DECLARE_POSTFIX_INCREMENT(BridgePieces) -enum { - MAX_BRIDGES = 13 -}; +static const uint MAX_BRIDGES = 13; typedef uint BridgeType; diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index e7b4dbf9c..69b93ccda 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -93,10 +93,8 @@ static const NWidgetPart _nested_build_vehicle_widgets[] = { }; /** Special cargo filter criteria */ -enum { - CF_ANY = CT_NO_REFIT, ///< Show all vehicles independent of carried cargo (i.e. no filtering) - CF_NONE = CT_INVALID, ///< Show only vehicles which do not carry cargo (e.g. train engines) -}; +static const CargoID CF_ANY = CT_NO_REFIT; ///< Show all vehicles independent of carried cargo (i.e. no filtering) +static const CargoID CF_NONE = CT_INVALID; ///< Show only vehicles which do not carry cargo (e.g. train engines) static bool _internal_sort_order; // descending/ascending static byte _last_sort_criteria[] = {0, 0, 0, 0}; diff --git a/src/command_type.h b/src/command_type.h index afc1d3f55..240c9f615 100644 --- a/src/command_type.h +++ b/src/command_type.h @@ -139,7 +139,7 @@ public: * * @see _command_proc_table */ -enum { +enum Commands { CMD_BUILD_RAILROAD_TRACK, ///< build a rail track CMD_REMOVE_RAILROAD_TRACK, ///< remove a rail track CMD_BUILD_SINGLE_RAIL, ///< build a single rail track @@ -322,7 +322,7 @@ DECLARE_ENUM_AS_BIT_SET(DoCommandFlag) * * This enumeration defines some flags which are binary-or'ed on a command. */ -enum { +enum FlaggedCommands { CMD_NETWORK_COMMAND = 0x0100, ///< execute the command without sending it on the network CMD_NO_TEST_IF_IN_NETWORK = 0x0200, ///< When enabled, the command will bypass the no-DC_EXEC round if in network CMD_FLAGS_MASK = 0xFF00, ///< mask for all command flags @@ -334,7 +334,7 @@ enum { * * This enumeration defines flags for the _command_proc_table. */ -enum { +enum CommandFlags { CMD_SERVER = 0x01, ///< the command can only be initiated by the server CMD_SPECTATOR = 0x02, ///< the command may be initiated by a spectator CMD_OFFLINE = 0x04, ///< the command cannot be executed in a multiplayer game; single-player only diff --git a/src/company_type.h b/src/company_type.h index a40a16ac0..77d73ed1f 100644 --- a/src/company_type.h +++ b/src/company_type.h @@ -37,16 +37,12 @@ enum Owner { }; DECLARE_POSTFIX_INCREMENT(Owner) -enum { - MAX_LENGTH_PRESIDENT_NAME_BYTES = 31, ///< The maximum length of a president name in bytes including '\0' - MAX_LENGTH_PRESIDENT_NAME_PIXELS = 94, ///< The maximum length of a president name in pixels - MAX_LENGTH_COMPANY_NAME_BYTES = 31, ///< The maximum length of a company name in bytes including '\0' - MAX_LENGTH_COMPANY_NAME_PIXELS = 150, ///< The maximum length of a company name in pixels -}; +static const uint MAX_LENGTH_PRESIDENT_NAME_BYTES = 31; ///< The maximum length of a president name in bytes including '\0' +static const uint MAX_LENGTH_PRESIDENT_NAME_PIXELS = 94; ///< The maximum length of a president name in pixels +static const uint MAX_LENGTH_COMPANY_NAME_BYTES = 31; ///< The maximum length of a company name in bytes including '\0' +static const uint MAX_LENGTH_COMPANY_NAME_PIXELS = 150; ///< The maximum length of a company name in pixels -enum { - MAX_HISTORY_MONTHS = 24, ///< The maximum number of months kept as performance's history -}; +static const uint MAX_HISTORY_MONTHS = 24; ///< The maximum number of months kept as performance's history /** Define basic enum properties */ template <> struct EnumPropsT : MakeEnumPropsT {}; diff --git a/src/console_internal.h b/src/console_internal.h index 2adf602ab..6debe8a19 100644 --- a/src/console_internal.h +++ b/src/console_internal.h @@ -14,10 +14,8 @@ #include "console_type.h" -enum { - ICON_CMDLN_SIZE = 1024, ///< maximum length of a typed in command - ICON_MAX_STREAMSIZE = 2048, ///< maximum length of a totally expanded command -}; +static const uint ICON_CMDLN_SIZE = 1024; ///< maximum length of a typed in command +static const uint ICON_MAX_STREAMSIZE = 2048; ///< maximum length of a totally expanded command /** Return values of console hooks (#IConsoleHook). */ enum ConsoleHookResult { diff --git a/src/currency.h b/src/currency.h index add9d6a95..1cc2d9559 100644 --- a/src/currency.h +++ b/src/currency.h @@ -15,12 +15,10 @@ #include "date_type.h" #include "strings_type.h" -enum { - CF_NOEURO = 0, - CF_ISEURO = 1, - NUM_CURRENCY = 29, - CUSTOM_CURRENCY_ID = NUM_CURRENCY - 1 -}; +static const int CF_NOEURO = 0; +static const int CF_ISEURO = 1; +static const uint NUM_CURRENCY = 29; +static const int CUSTOM_CURRENCY_ID = NUM_CURRENCY - 1; struct CurrencySpec { uint16 rate; diff --git a/src/date_type.h b/src/date_type.h index e0481ff49..4930979cd 100644 --- a/src/date_type.h +++ b/src/date_type.h @@ -12,17 +12,24 @@ #ifndef DATE_TYPE_H #define DATE_TYPE_H + +typedef int32 Date; ///< The type to store our dates in +typedef uint16 DateFract; ///< The fraction of a date we're in, i.e. the number of ticks since the last date changeover +typedef int32 Ticks; ///< The type to store ticks in + +typedef int32 Year; ///< Type for the year, note: 0 based, i.e. starts at the year 0. +typedef uint8 Month; ///< Type for the month, note: 0 based, i.e. 0 = January, 11 = December. +typedef uint8 Day; ///< Type for the day of the month, note: 1 based, first day of a month is 1. + /** * 1 day is 74 ticks; _date_fract used to be uint16 and incremented by 885. On * an overflow the new day begun and 65535 / 885 = 74. * 1 tick is approximately 30 ms. * 1 day is thus about 2 seconds (74 * 30 = 2220) on a machine that can run OpenTTD normally */ -enum { - DAY_TICKS = 74, ///< ticks per day - DAYS_IN_YEAR = 365, ///< days per year - DAYS_IN_LEAP_YEAR = 366, ///< sometimes, you need one day more... -}; +static const int DAY_TICKS = 74; ///< ticks per day +static const int DAYS_IN_YEAR = 365; ///< days per year +static const int DAYS_IN_LEAP_YEAR = 366; ///< sometimes, you need one day more... /* * ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR and DAYS_TILL_ORIGINAL_BASE_YEAR are @@ -32,11 +39,11 @@ enum { */ /** The minimum starting year/base year of the original TTD */ -#define ORIGINAL_BASE_YEAR 1920 +static const Year ORIGINAL_BASE_YEAR = 1920; /** The original ending year */ -#define ORIGINAL_END_YEAR 2051 +static const Year ORIGINAL_END_YEAR = 2051; /** The maximum year of the original TTD */ -#define ORIGINAL_MAX_YEAR 2090 +static const Year ORIGINAL_MAX_YEAR = 2090; /** * Calculate the number of leap years till a given year. @@ -66,28 +73,20 @@ enum { #define DAYS_TILL_ORIGINAL_BASE_YEAR DAYS_TILL(ORIGINAL_BASE_YEAR) /** The absolute minimum & maximum years in OTTD */ -#define MIN_YEAR 0 +static const Year MIN_YEAR = 0; /** The default starting year */ -#define DEF_START_YEAR 1950 +static const Year DEF_START_YEAR = 1950; /** * MAX_YEAR, nicely rounded value of the number of years that can * be encoded in a single 32 bits date, about 2^31 / 366 years. */ -#define MAX_YEAR 5000000 +static const Year MAX_YEAR = 5000000; /** The number of days till the last day */ #define MAX_DAY (DAYS_TILL(MAX_YEAR + 1) - 1) -typedef int32 Date; ///< The type to store our dates in -typedef uint16 DateFract; ///< The fraction of a date we're in, i.e. the number of ticks since the last date changeover -typedef int32 Ticks; ///< The type to store ticks in - -typedef int32 Year; ///< Type for the year, note: 0 based, i.e. starts at the year 0. -typedef uint8 Month; ///< Type for the month, note: 0 based, i.e. 0 = January, 11 = December. -typedef uint8 Day; ///< Type for the day of the month, note: 1 based, first day of a month is 1. - /** * Data structure to convert between Date and triplet (year, month, and day). * @see ConvertDateToYMD(), ConvertYMDToDate() diff --git a/src/economy_type.h b/src/economy_type.h index 2abc9c643..08cb2ceca 100644 --- a/src/economy_type.h +++ b/src/economy_type.h @@ -196,11 +196,9 @@ static const uint64 MAX_INFLATION = (1ull << (63 - 32)) - 1; * Increasing base prices by factor 65536 should be enough. * @see MAX_INFLATION */ -enum { - MIN_PRICE_MODIFIER = -8, - MAX_PRICE_MODIFIER = 16, - INVALID_PRICE_MODIFIER = MIN_PRICE_MODIFIER - 1, -}; +static const int MIN_PRICE_MODIFIER = -8; +static const int MAX_PRICE_MODIFIER = 16; +static const int INVALID_PRICE_MODIFIER = MIN_PRICE_MODIFIER - 1; struct CargoPayment; typedef uint32 CargoPaymentID; diff --git a/src/engine_type.h b/src/engine_type.h index 48a408b6d..6f9db7964 100644 --- a/src/engine_type.h +++ b/src/engine_type.h @@ -71,7 +71,7 @@ struct ShipVehicleInfo { /* AircraftVehicleInfo subtypes, bitmask type. * If bit 0 is 0 then it is a helicopter, otherwise it is a plane * in which case bit 1 tells us whether it's a big(fast) plane or not */ -enum { +enum AircraftSubTypeBits { AIR_HELI = 0, AIR_CTOL = 1, ///< Conventional Take Off and Landing, i.e. planes AIR_FAST = 2 @@ -125,7 +125,7 @@ struct EngineInfo { /** * EngineInfo.misc_flags is a bitmask, with the following values */ -enum { +enum EngineMiscFlags { EF_RAIL_TILTS = 0, ///< Rail vehicle tilts in curves EF_ROAD_TRAM = 0, ///< Road vehicle is a tram/light rail vehicle EF_USES_2CC = 1, ///< Vehicle uses two company colours @@ -135,17 +135,15 @@ enum { /** * Engine.flags is a bitmask, with the following values. */ -enum { +enum EngineFlags { ENGINE_AVAILABLE = 1, ///< This vehicle is available to everyone. ENGINE_EXCLUSIVE_PREVIEW = 2, ///< This vehicle is in the exclusive preview stage, either being used or being offered to a company. ENGINE_OFFER_WINDOW_OPEN = 4, ///< The exclusive offer window is currently open for a company. }; -enum { - NUM_VEHICLE_TYPES = 6, - MAX_LENGTH_ENGINE_NAME_BYTES = 31, ///< The maximum length of an engine name in bytes including '\0' - MAX_LENGTH_ENGINE_NAME_PIXELS = 160, ///< The maximum length of an engine name in pixels -}; +static const uint NUM_VEHICLE_TYPES = 6; +static const uint MAX_LENGTH_ENGINE_NAME_BYTES = 31; ///< The maximum length of an engine name in bytes including '\0' +static const uint MAX_LENGTH_ENGINE_NAME_PIXELS = 160; ///< The maximum length of an engine name in pixels static const EngineID INVALID_ENGINE = 0xFFFF; diff --git a/src/fios.h b/src/fios.h index 4338be727..42c50a9ba 100644 --- a/src/fios.h +++ b/src/fios.h @@ -15,7 +15,7 @@ #include "strings_type.h" #include "core/smallvec_type.hpp" -enum { +enum FileSlots { /** * Slot used for the GRF scanning and such. This slot cannot be reused * as it will otherwise cause issues when pressing "rescan directories". @@ -80,7 +80,7 @@ struct SmallFiosItem { char title[255]; ///< internal name of the game }; -enum { +enum SortingBits { SORT_ASCENDING = 0, SORT_DESCENDING = 1, SORT_BY_DATE = 0, diff --git a/src/genworld.h b/src/genworld.h index a4399097e..a32cf2115 100644 --- a/src/genworld.h +++ b/src/genworld.h @@ -15,17 +15,16 @@ #include "company_type.h" /** Constants related to world generation */ -enum { +enum LandscapeGenerator { /* Order of these enums has to be the same as in lang/english.txt * Otherwise you will get inconsistent behaviour. */ LG_ORIGINAL = 0, ///< The original landscape generator LG_TERRAGENESIS = 1, ///< TerraGenesis Perlin landscape generator - - GENERATE_NEW_SEED = UINT_MAX, ///< Create a new random seed - - GENWORLD_REDRAW_TIMEOUT = 200, ///< Timeout between redraws }; +static const uint GENERATE_NEW_SEED = UINT_MAX; ///< Create a new random seed +static const uint GENWORLD_REDRAW_TIMEOUT = 200; ///< Timeout between redraws + /** Modes for GenerateWorld */ enum GenWorldMode { GWM_NEWGAME = 0, ///< Generate a map for a new game diff --git a/src/gfx_func.h b/src/gfx_func.h index 0f05f39d0..1bbaefc17 100644 --- a/src/gfx_func.h +++ b/src/gfx_func.h @@ -82,10 +82,8 @@ void ScreenSizeChanged(); void GameSizeChanged(); void UndrawMouseCursor(); -enum { - /* Size of the buffer used for drawing strings. */ - DRAW_STRING_BUFFER = 2048, -}; +/** Size of the buffer used for drawing strings. */ +static const int DRAW_STRING_BUFFER = 2048; void RedrawScreenRect(int left, int top, int right, int bottom); void GfxScroll(int left, int top, int width, int height, int xo, int yo); diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 44cfe2f16..f07b52754 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -175,14 +175,12 @@ enum CompanyValueWidgets { struct BaseGraphWindow : Window { protected: - enum { - GRAPH_MAX_DATASETS = 32, - GRAPH_AXIS_LINE_COLOUR = 215, - GRAPH_NUM_MONTHS = 24, ///< Number of months displayed in the graph. + static const int GRAPH_MAX_DATASETS = 32; + static const int GRAPH_AXIS_LINE_COLOUR = 215; + static const int GRAPH_NUM_MONTHS = 24; ///< Number of months displayed in the graph. - MIN_GRAPH_NUM_LINES_Y = 9, ///< Minimal number of horizontal lines to draw. - MIN_GRID_PIXEL_SIZE = 20, ///< Minimum distance between graph lines. - }; + static const int MIN_GRAPH_NUM_LINES_Y = 9; ///< Minimal number of horizontal lines to draw. + static const int MIN_GRID_PIXEL_SIZE = 20; ///< Minimum distance between graph lines. uint excluded_data; ///< bitmask of the datasets that shouldn't be displayed. byte num_dataset; diff --git a/src/group_type.h b/src/group_type.h index 662d14241..ed883eabd 100644 --- a/src/group_type.h +++ b/src/group_type.h @@ -14,14 +14,12 @@ typedef uint16 GroupID; -enum { - ALL_GROUP = 0xFFFD, - DEFAULT_GROUP = 0xFFFE, ///< ungrouped vehicles are in this group. - INVALID_GROUP = 0xFFFF, - - MAX_LENGTH_GROUP_NAME_BYTES = 31, ///< The maximum length of a group name in bytes including '\0' - MAX_LENGTH_GROUP_NAME_PIXELS = 150, ///< The maximum length of a group name in pixels -}; +static const GroupID ALL_GROUP = 0xFFFD; +static const GroupID DEFAULT_GROUP = 0xFFFE; ///< ungrouped vehicles are in this group. +static const GroupID INVALID_GROUP = 0xFFFF; + +static const uint MAX_LENGTH_GROUP_NAME_BYTES = 31; ///< The maximum length of a group name in bytes including '\0' +static const uint MAX_LENGTH_GROUP_NAME_PIXELS = 150; ///< The maximum length of a group name in pixels struct Group; diff --git a/src/heightmap.h b/src/heightmap.h index d4cafa50b..16ef279c7 100644 --- a/src/heightmap.h +++ b/src/heightmap.h @@ -16,7 +16,7 @@ * Order of these enums has to be the same as in lang/english.txt * Otherwise you will get inconsistent behaviour. */ -enum { +enum HeightmapRotation { HM_COUNTER_CLOCKWISE, ///< Rotate the map counter clockwise 45 degrees HM_CLOCKWISE, ///< Rotate the map clockwise 45 degrees }; diff --git a/src/house.h b/src/house.h index 15b0a38bc..266e5e7fd 100644 --- a/src/house.h +++ b/src/house.h @@ -22,16 +22,14 @@ * construction. */ static const byte TOWN_HOUSE_COMPLETED = 3; -enum { - HOUSE_NO_CLASS = 0, - NEW_HOUSE_OFFSET = 110, - HOUSE_MAX = 512, - INVALID_HOUSE_ID = 0xFFFF, - - /* There can only be as many classes as there are new houses, plus one for - * NO_CLASS, as the original houses don't have classes. */ - HOUSE_CLASS_MAX = HOUSE_MAX - NEW_HOUSE_OFFSET + 1, -}; +static const uint HOUSE_NO_CLASS = 0; +static const HouseID NEW_HOUSE_OFFSET = 110; +static const HouseID HOUSE_MAX = 512; +static const HouseID INVALID_HOUSE_ID = 0xFFFF; + +/** There can only be as many classes as there are new houses, plus one for + * NO_CLASS, as the original houses don't have classes. */ +static const uint HOUSE_CLASS_MAX = HOUSE_MAX - NEW_HOUSE_OFFSET + 1; enum BuildingFlags { TILE_NO_FLAG = 0, diff --git a/src/industry_map.h b/src/industry_map.h index 02e7cfafe..8888de808 100644 --- a/src/industry_map.h +++ b/src/industry_map.h @@ -21,7 +21,7 @@ * They all are pointing toward array _industry_draw_tile_data, in table/industry_land.h * How to calculate the correct position ? GFXid << 2 | IndustryStage (0 to 3) */ -enum { +enum IndustryGraphics { GFX_COAL_MINE_TOWER_NOT_ANIMATED = 0, GFX_COAL_MINE_TOWER_ANIMATED = 1, GFX_POWERPLANT_CHIMNEY = 8, diff --git a/src/industry_type.h b/src/industry_type.h index bdf241715..34650d785 100644 --- a/src/industry_type.h +++ b/src/industry_type.h @@ -22,15 +22,15 @@ struct IndustryTileSpec; static const IndustryID INVALID_INDUSTRY = 0xFFFF; -enum { - NEW_INDUSTRYOFFSET = 37, ///< original number of industries - NUM_INDUSTRYTYPES = 64, ///< total number of industries, new and old - INDUSTRYTILE_NOANIM = 0xFF, ///< flag to mark industry tiles as having no animation - NEW_INDUSTRYTILEOFFSET = 175, ///< original number of tiles - INVALID_INDUSTRYTYPE = NUM_INDUSTRYTYPES, ///< one above amount is considered invalid - NUM_INDUSTRYTILES = 512, ///< total number of industry tiles, new and old - INVALID_INDUSTRYTILE = NUM_INDUSTRYTILES, ///< one above amount is considered invalid - INDUSTRY_COMPLETED = 3, ///< final stage of industry construction. -}; +static const IndustryType NEW_INDUSTRYOFFSET = 37; ///< original number of industries +static const IndustryType NUM_INDUSTRYTYPES = 64; ///< total number of industries, new and old +static const IndustryType INVALID_INDUSTRYTYPE = NUM_INDUSTRYTYPES; ///< one above amount is considered invalid + +static const IndustryGfx INDUSTRYTILE_NOANIM = 0xFF; ///< flag to mark industry tiles as having no animation +static const IndustryGfx NEW_INDUSTRYTILEOFFSET = 175; ///< original number of tiles +static const IndustryGfx NUM_INDUSTRYTILES = 512; ///< total number of industry tiles, new and old +static const IndustryGfx INVALID_INDUSTRYTILE = NUM_INDUSTRYTILES; ///< one above amount is considered invalid + +static const int INDUSTRY_COMPLETED = 3; ///< final stage of industry construction. #endif /* INDUSTRY_TYPE_H */ diff --git a/src/industrytype.h b/src/industrytype.h index e41b0ed8e..b61fc7c2a 100644 --- a/src/industrytype.h +++ b/src/industrytype.h @@ -21,7 +21,7 @@ #include "cargo_type.h" #include "newgrf_commons.h" -enum { +enum IndustryCleanupType { CLEAN_RANDOMSOUNDS, ///< Free the dynamically allocated sounds table CLEAN_TILELAYOUT, ///< Free the dynamically allocated tile layout structure }; diff --git a/src/landscape.h b/src/landscape.h index d505d6834..c2c20a4fe 100644 --- a/src/landscape.h +++ b/src/landscape.h @@ -15,10 +15,8 @@ #include "core/geometry_type.hpp" #include "tile_cmd.h" -enum { - SNOW_LINE_MONTHS = 12, ///< Number of months in the snow line table. - SNOW_LINE_DAYS = 32, ///< Number of days in each month in the snow line table. -}; +static const uint SNOW_LINE_MONTHS = 12; ///< Number of months in the snow line table. +static const uint SNOW_LINE_DAYS = 32; ///< Number of days in each month in the snow line table. /** Structure describing the height of the snow line each day of the year * @ingroup SnowLineGroup */ diff --git a/src/map_type.h b/src/map_type.h index 44434e536..9c1d1c925 100644 --- a/src/map_type.h +++ b/src/map_type.h @@ -58,12 +58,10 @@ struct TileIndexDiffC { }; /** Minimal and maximal map width and height */ -enum { - MIN_MAP_SIZE_BITS = 6, ///< Minimal size of map is equal to 2 ^ MIN_MAP_SIZE_BITS - MAX_MAP_SIZE_BITS = 11, ///< Maximal size of map is equal to 2 ^ MAX_MAP_SIZE_BITS - MIN_MAP_SIZE = 1 << MIN_MAP_SIZE_BITS, ///< Minimal map size = 64 - MAX_MAP_SIZE = 1 << MAX_MAP_SIZE_BITS, ///< Maximal map size = 2048 -}; +static const uint MIN_MAP_SIZE_BITS = 6; ///< Minimal size of map is equal to 2 ^ MIN_MAP_SIZE_BITS +static const uint MAX_MAP_SIZE_BITS = 11; ///< Maximal size of map is equal to 2 ^ MAX_MAP_SIZE_BITS +static const uint MIN_MAP_SIZE = 1 << MIN_MAP_SIZE_BITS; ///< Minimal map size = 64 +static const uint MAX_MAP_SIZE = 1 << MAX_MAP_SIZE_BITS; ///< Maximal map size = 2048 /** * Approximation of the length of a straight track, relative to a diagonal diff --git a/src/newgrf.h b/src/newgrf.h index 688f6c0b2..e9d5b9573 100644 --- a/src/newgrf.h +++ b/src/newgrf.h @@ -127,7 +127,7 @@ struct GRFFile { RailType railtype_map[RAILTYPE_END]; int traininfo_vehicle_pitch; ///< Vertical offset for draing train images in depot GUI and vehicle details - int traininfo_vehicle_width; ///< Width (in pixels) of a 8/8 train vehicle in depot GUI and vehicle details + uint traininfo_vehicle_width; ///< Width (in pixels) of a 8/8 train vehicle in depot GUI and vehicle details uint32 grf_features; ///< Bitset of GrfSpecFeature the grf uses PriceMultipliers price_base_multipliers; ///< Price base multipliers as set by the grf. diff --git a/src/newgrf_callbacks.h b/src/newgrf_callbacks.h index 0513907a3..4c4a56953 100644 --- a/src/newgrf_callbacks.h +++ b/src/newgrf_callbacks.h @@ -341,9 +341,7 @@ enum AirportTileCallbackMask { /** * Different values for Callback result evaluations */ -enum { - CALLBACK_FAILED = 0xFFFF, ///< Result of a failed callback. - CALLBACK_HOUSEPRODCARGO_END = 0x20FF, ///< Sentinel indicating that the loop for CBID_HOUSE_PRODUCE_CARGO has ended -}; +static const uint CALLBACK_FAILED = 0xFFFF; ///< Result of a failed callback. +static const uint CALLBACK_HOUSEPRODCARGO_END = 0x20FF; ///< Sentinel indicating that the loop for CBID_HOUSE_PRODUCE_CARGO has ended #endif /* NEWGRF_CALLBACKS_H */ diff --git a/src/newgrf_engine.h b/src/newgrf_engine.h index 91a15f4a7..edc8b29bd 100644 --- a/src/newgrf_engine.h +++ b/src/newgrf_engine.h @@ -19,11 +19,9 @@ #include "engine_type.h" #include "gfx_type.h" -enum { - TRAININFO_DEFAULT_VEHICLE_WIDTH = 29, - ROADVEHINFO_DEFAULT_VEHICLE_WIDTH = 28, - VEHICLEINFO_FULL_VEHICLE_WIDTH = 32, -}; +static const uint TRAININFO_DEFAULT_VEHICLE_WIDTH = 29; +static const uint ROADVEHINFO_DEFAULT_VEHICLE_WIDTH = 28; +static const uint VEHICLEINFO_FULL_VEHICLE_WIDTH = 32; void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const struct SpriteGroup *group, EngineID *train_id, uint trains); const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID cargo, EngineID overriding_engine); diff --git a/src/openttd.h b/src/openttd.h index fa96f5a97..131a8bd60 100644 --- a/src/openttd.h +++ b/src/openttd.h @@ -36,7 +36,7 @@ enum SwitchMode { }; /* Display Options */ -enum { +enum DisplayOptions { DO_SHOW_TOWN_NAMES = 0, DO_SHOW_STATION_NAMES = 1, DO_SHOW_SIGNS = 2, diff --git a/src/order_type.h b/src/order_type.h index 757603fcb..029674bb0 100644 --- a/src/order_type.h +++ b/src/order_type.h @@ -163,7 +163,7 @@ enum OrderDepotAction { /* Possible clone options */ -enum { +enum CloneOptions { CO_SHARE = 0, CO_COPY = 1, CO_UNSHARE = 2 diff --git a/src/pathfinder/npf/aystar.h b/src/pathfinder/npf/aystar.h index 426a292a0..5be2dd3e4 100644 --- a/src/pathfinder/npf/aystar.h +++ b/src/pathfinder/npf/aystar.h @@ -23,7 +23,7 @@ #include "../../track_type.h" //#define AYSTAR_DEBUG -enum { +enum AystarStatus { AYSTAR_FOUND_END_NODE, AYSTAR_EMPTY_OPENLIST, AYSTAR_STILL_BUSY, @@ -32,9 +32,7 @@ enum { AYSTAR_DONE }; -enum { - AYSTAR_INVALID_NODE = -1, -}; +static const int AYSTAR_INVALID_NODE = -1; struct AyStarNode { TileIndex tile; diff --git a/src/roadveh.h b/src/roadveh.h index 5983effba..fc0eb8b94 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -55,24 +55,22 @@ enum RoadVehicleStates { }; /** State information about the Road Vehicle controller */ -enum { - RDE_NEXT_TILE = 0x80, ///< We should enter the next tile - RDE_TURNED = 0x40, ///< We just finished turning - - /* Start frames for when a vehicle enters a tile/changes its state. - * The start frame is different for vehicles that turned around or - * are leaving the depot as the do not start at the edge of the tile. - * For trams there are a few different start frames as there are two - * places where trams can turn. */ - RVC_DEFAULT_START_FRAME = 0, - RVC_TURN_AROUND_START_FRAME = 1, - RVC_DEPOT_START_FRAME = 6, - RVC_START_FRAME_AFTER_LONG_TRAM = 21, - RVC_TURN_AROUND_START_FRAME_SHORT_TRAM = 16, - /* Stop frame for a vehicle in a drive-through stop */ - RVC_DRIVE_THROUGH_STOP_FRAME = 11, - RVC_DEPOT_STOP_FRAME = 11, -}; +static const uint RDE_NEXT_TILE = 0x80; ///< We should enter the next tile +static const uint RDE_TURNED = 0x40; ///< We just finished turning + +/* Start frames for when a vehicle enters a tile/changes its state. + * The start frame is different for vehicles that turned around or + * are leaving the depot as the do not start at the edge of the tile. + * For trams there are a few different start frames as there are two + * places where trams can turn. */ +static const uint RVC_DEFAULT_START_FRAME = 0; +static const uint RVC_TURN_AROUND_START_FRAME = 1; +static const uint RVC_DEPOT_START_FRAME = 6; +static const uint RVC_START_FRAME_AFTER_LONG_TRAM = 21; +static const uint RVC_TURN_AROUND_START_FRAME_SHORT_TRAM = 16; +/* Stop frame for a vehicle in a drive-through stop */ +static const uint RVC_DRIVE_THROUGH_STOP_FRAME = 11; +static const uint RVC_DEPOT_STOP_FRAME = 11; enum RoadVehicleSubType { RVST_FRONT, diff --git a/src/saveload/map_sl.cpp b/src/saveload/map_sl.cpp index 590be2ac5..de6f16a47 100644 --- a/src/saveload/map_sl.cpp +++ b/src/saveload/map_sl.cpp @@ -38,9 +38,7 @@ static void Load_MAPS() AllocateMap(_map_dim_x, _map_dim_y); } -enum { - MAP_SL_BUF_SIZE = 4096 -}; +static const uint MAP_SL_BUF_SIZE = 4096; static void Load_MAPT() { diff --git a/src/saveload/oldloader.cpp b/src/saveload/oldloader.cpp index c7cff7279..b0688ed7a 100644 --- a/src/saveload/oldloader.cpp +++ b/src/saveload/oldloader.cpp @@ -22,10 +22,8 @@ #include "saveload_internal.h" #include "oldloader.h" -enum { - TTO_HEADER_SIZE = 41, - TTD_HEADER_SIZE = 49, -}; +static const int TTO_HEADER_SIZE = 41; +static const int TTD_HEADER_SIZE = 49; uint32 _bump_assert_value; diff --git a/src/saveload/oldloader.h b/src/saveload/oldloader.h index b0f1688f2..6720a28a6 100644 --- a/src/saveload/oldloader.h +++ b/src/saveload/oldloader.h @@ -15,10 +15,8 @@ #include "saveload.h" #include "../tile_type.h" -enum { - BUFFER_SIZE = 4096, - OLD_MAP_SIZE = 256 * 256, -}; +static const uint BUFFER_SIZE = 4096; +static const uint OLD_MAP_SIZE = 256 * 256; struct LoadgameState { FILE *file; diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 0914a50ea..0e7c7e5f7 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -81,11 +81,7 @@ enum SLRefType { #define SL_MAX_VERSION 255 -enum { - INC_VEHICLE_COMMON = 0, -}; - -enum { +enum ChunkType { CH_RIFF = 0, CH_ARRAY = 1, CH_SPARSE_ARRAY = 2, diff --git a/src/signs_type.h b/src/signs_type.h index 81afc2a7d..a54808705 100644 --- a/src/signs_type.h +++ b/src/signs_type.h @@ -15,11 +15,9 @@ typedef uint16 SignID; struct Sign; -enum { - INVALID_SIGN = 0xFFFF, +static const SignID INVALID_SIGN = 0xFFFF; - MAX_LENGTH_SIGN_NAME_BYTES = 31, ///< The maximum length of a sign name in bytes including '\0' - MAX_LENGTH_SIGN_NAME_PIXELS = 255, ///< The maximum length of a sign name in pixels -}; +static const uint MAX_LENGTH_SIGN_NAME_BYTES = 31; ///< The maximum length of a sign name in bytes including '\0' +static const uint MAX_LENGTH_SIGN_NAME_PIXELS = 255; ///< The maximum length of a sign name in pixels #endif /* SIGNS_TYPE_H */ diff --git a/src/station_map.h b/src/station_map.h index 060457d15..ef4e243e1 100644 --- a/src/station_map.h +++ b/src/station_map.h @@ -33,10 +33,8 @@ static inline StationID GetStationIndex(TileIndex t) } -enum { - GFX_DOCK_BASE_WATER_PART = 4, - GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET = 4, -}; +static const int GFX_DOCK_BASE_WATER_PART = 4; +static const int GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET = 4; /** * Get the station type of this tile diff --git a/src/station_type.h b/src/station_type.h index d49237154..3ba1a478e 100644 --- a/src/station_type.h +++ b/src/station_type.h @@ -86,10 +86,8 @@ enum CatchmentArea { MAX_CATCHMENT = 10, ///< Maximum catchment for airports with "modified catchment" enabled }; -enum { - MAX_LENGTH_STATION_NAME_BYTES = 31, ///< The maximum length of a station name in bytes including '\0' - MAX_LENGTH_STATION_NAME_PIXELS = 180, ///< The maximum length of a station name in pixels -}; +static const uint MAX_LENGTH_STATION_NAME_BYTES = 31; ///< The maximum length of a station name in bytes including '\0' +static const uint MAX_LENGTH_STATION_NAME_PIXELS = 180; ///< The maximum length of a station name in pixels /** List of stations */ typedef SmallVector StationList; diff --git a/src/strings_type.h b/src/strings_type.h index cb355fb8c..d83b1b79e 100644 --- a/src/strings_type.h +++ b/src/strings_type.h @@ -16,12 +16,9 @@ * Numeric value that represents a string, independent of the selected language. */ typedef uint16 StringID; -static const StringID INVALID_STRING_ID = 0xFFFF; ///< Constant representing an invalid string -static const int MAX_CHAR_LENGTH = 4; ///< Max. length of UTF-8 encoded unicode character - -enum { - MAX_LANG = 64, ///< Maximal number of languages supported by the game -}; +static const StringID INVALID_STRING_ID = 0xFFFF; ///< Constant representing an invalid string +static const int MAX_CHAR_LENGTH = 4; ///< Max. length of UTF-8 encoded unicode character +static const uint MAX_LANG = 64; ///< Maximum number of languages supported by the game /** Directions a text can go to */ enum TextDirection { diff --git a/src/subsidy.cpp b/src/subsidy.cpp index 66983ef30..997443d9e 100644 --- a/src/subsidy.cpp +++ b/src/subsidy.cpp @@ -205,7 +205,7 @@ static Subsidy *FindSubsidyCargoRoute() if (i == NULL) return NULL; CargoID cargo; - int trans, total; + uint trans, total; /* Randomize cargo type */ if (i->produced_cargo[1] != CT_INVALID && HasBit(Random(), 0)) { diff --git a/src/subsidy_base.h b/src/subsidy_base.h index c797c419d..5c09260ad 100644 --- a/src/subsidy_base.h +++ b/src/subsidy_base.h @@ -53,14 +53,12 @@ struct Subsidy : SubsidyPool::PoolItem<&_subsidy_pool> { }; /** Constants related to subsidies */ -enum { - SUBSIDY_OFFER_MONTHS = 12, ///< Duration of subsidy offer - SUBSIDY_CONTRACT_MONTHS = 12, ///< Duration of subsidy after awarding - SUBSIDY_PAX_MIN_POPULATION = 400, ///< Min. population of towns for subsidised pax route - SUBSIDY_CARGO_MIN_POPULATION = 900, ///< Min. population of destination town for cargo route - SUBSIDY_MAX_PCT_TRANSPORTED = 42, ///< Subsidy will be created only for towns/industries with less % transported - SUBSIDY_MAX_DISTANCE = 70, ///< Max. length of subsidised route (DistanceManhattan) -}; +static const uint SUBSIDY_OFFER_MONTHS = 12; ///< Duration of subsidy offer +static const uint SUBSIDY_CONTRACT_MONTHS = 12; ///< Duration of subsidy after awarding +static const uint SUBSIDY_PAX_MIN_POPULATION = 400; ///< Min. population of towns for subsidised pax route +static const uint SUBSIDY_CARGO_MIN_POPULATION = 900; ///< Min. population of destination town for cargo route +static const uint SUBSIDY_MAX_PCT_TRANSPORTED = 42; ///< Subsidy will be created only for towns/industries with less % transported +static const uint SUBSIDY_MAX_DISTANCE = 70; ///< Max. length of subsidised route (DistanceManhattan) #define FOR_ALL_SUBSIDIES_FROM(var, start) FOR_ALL_ITEMS_FROM(Subsidy, subsidy_index, var, start) #define FOR_ALL_SUBSIDIES(var) FOR_ALL_SUBSIDIES_FROM(var, 0) diff --git a/src/table/build_industry.h b/src/table/build_industry.h index c7e7870da..99165df37 100644 --- a/src/table/build_industry.h +++ b/src/table/build_industry.h @@ -1098,7 +1098,7 @@ static const uint8 _farm_sounds[] = { SND_24_SHEEP, SND_25_COW, SND_26_HORSE }; /** Array with... hem... a sound of toyland */ static const uint8 _plastic_mine_sounds[] = { SND_33_PLASTIC_MINE }; -enum { +enum IndustryTypes { IT_COAL_MINE = 0, IT_POWER_STATION = 1, IT_SAWMILL = 2, diff --git a/src/table/elrail_data.h b/src/table/elrail_data.h index 55725a249..4c008a773 100644 --- a/src/table/elrail_data.h +++ b/src/table/elrail_data.h @@ -33,9 +33,7 @@ enum TileSource { TS_END }; -enum { - NUM_TRACKS_AT_PCP = 6 -}; +static const uint NUM_TRACKS_AT_PCP = 6; /** Which PPPs are possible at all on a given PCP */ static const byte AllowedPPPonPCP[DIAGDIR_END] = { @@ -316,12 +314,10 @@ struct SortableSpriteStruct { int8 z_offset; }; -enum { - /** Distance between wire and rail */ - ELRAIL_ELEVATION = 10, - /** Wires that a draw one level higher than the north corner. */ - ELRAIL_ELEVRAISE = ELRAIL_ELEVATION + TILE_HEIGHT -}; +/** Distance between wire and rail */ +static const uint ELRAIL_ELEVATION = 10; +/** Wires that a draw one level higher than the north corner. */ +static const uint ELRAIL_ELEVRAISE = ELRAIL_ELEVATION + TILE_HEIGHT; static const SortableSpriteStruct CatenarySpriteData[] = { /* X direction diff --git a/src/table/landscape_sprite.h b/src/table/landscape_sprite.h index 32f674e0a..13fe22c92 100644 --- a/src/table/landscape_sprite.h +++ b/src/table/landscape_sprite.h @@ -9,9 +9,7 @@ /** @file landscape_sprite.h Offsets of sprites to replace for non-temperate landscapes. */ -enum { - END = 0xFFFF -}; +static const SpriteID END = 0xFFFF; static const SpriteID _landscape_spriteindexes_1[] = { 0xF67, 0xF9F, diff --git a/src/table/palettes.h b/src/table/palettes.h index 5ab88df69..68f74377f 100644 --- a/src/table/palettes.h +++ b/src/table/palettes.h @@ -154,13 +154,11 @@ static const Colour _palettes[][256] = { #define GET_PALETTE(x) _palettes[x] /** Description of the length of the palette cycle animations */ -enum { - EPV_CYCLES_DARK_WATER = 5, ///< length of the dark blue water animation - EPV_CYCLES_LIGHTHOUSE = 4, ///< length of the lighthouse/stadium animation - EPV_CYCLES_OIL_REFINERY = 7, ///< length of the oil refinery's fire animation - EPV_CYCLES_FIZZY_DRINK = 5, ///< length of the fizzy drinks animation - EPV_CYCLES_GLITTER_WATER = 15, ///< length of the glittery water animation -}; +static const uint EPV_CYCLES_DARK_WATER = 5; ///< length of the dark blue water animation +static const uint EPV_CYCLES_LIGHTHOUSE = 4; ///< length of the lighthouse/stadium animation +static const uint EPV_CYCLES_OIL_REFINERY = 7; ///< length of the oil refinery's fire animation +static const uint EPV_CYCLES_FIZZY_DRINK = 5; ///< length of the fizzy drinks animation +static const uint EPV_CYCLES_GLITTER_WATER = 15; ///< length of the glittery water animation /** Description of tables for the palette animation */ struct ExtraPaletteValues { diff --git a/src/table/unicode.h b/src/table/unicode.h index 4c7f45107..862878e6f 100644 --- a/src/table/unicode.h +++ b/src/table/unicode.h @@ -14,10 +14,8 @@ struct DefaultUnicodeMapping { byte key; ///< Character index of sprite }; -enum { - CLRA = 0, ///< Identifier to clear all glyphs at this codepoint - CLRL = 1, ///< Identifier to clear glyphs for large font at this codepoint -}; +static const byte CLRA = 0; ///< Identifier to clear all glyphs at this codepoint +static const byte CLRL = 1; ///< Identifier to clear glyphs for large font at this codepoint /* Default unicode mapping table for sprite based glyphs. * This table allows us use unicode characters even though the glyphs don't diff --git a/src/town.h b/src/town.h index b1cae99cc..47e3313d3 100644 --- a/src/town.h +++ b/src/town.h @@ -173,7 +173,7 @@ static const byte TOWN_GROWTH_FREQUENCY = 70; * per town, NO MATTER the population of it. * And there are 5 more bits available on flags... */ -enum { +enum TownFlags { TOWN_IS_FUNDED = 0, ///< Town has received some funds for TOWN_HAS_CHURCH = 1, ///< There can be only one church by town. TOWN_HAS_STADIUM = 2 ///< There can be only one stadium by town. diff --git a/src/town_gui.cpp b/src/town_gui.cpp index f2e5bebfb..02ea76b6a 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -312,9 +312,7 @@ private: Town *town; ///< Town displayed by the window. public: - enum { - TVW_HEIGHT_NORMAL = 150, - }; + static const int TVW_HEIGHT_NORMAL = 150; TownViewWindow(const WindowDesc *desc, WindowNumber window_number) : Window() { diff --git a/src/town_type.h b/src/town_type.h index 93dcc1a3a..8af2af8e1 100644 --- a/src/town_type.h +++ b/src/town_type.h @@ -28,7 +28,7 @@ enum TownSize { }; template <> struct EnumPropsT : MakeEnumPropsT {}; -enum { +enum Ratings { /* These refer to the maximums, so Appalling is -1000 to -400 * MAXIMUM RATINGS BOUNDARIES */ RATING_MINIMUM = -1000, @@ -105,9 +105,7 @@ enum TownFounding { /** It needs to be 8bits, because we save and load it as such */ typedef SimpleTinyEnumT TownFoundingByte; -enum { - MAX_LENGTH_TOWN_NAME_BYTES = 31, ///< The maximum length of a town name in bytes including '\0' - MAX_LENGTH_TOWN_NAME_PIXELS = 130, ///< The maximum length of a town name in pixels -}; +static const uint MAX_LENGTH_TOWN_NAME_BYTES = 31; ///< The maximum length of a town name in bytes including '\0' +static const uint MAX_LENGTH_TOWN_NAME_PIXELS = 130; ///< The maximum length of a town name in pixels #endif /* TOWN_TYPE_H */ diff --git a/src/tree_map.h b/src/tree_map.h index ddda6ac54..0b78504f0 100644 --- a/src/tree_map.h +++ b/src/tree_map.h @@ -40,13 +40,11 @@ enum TreeType { * 5 entries instead of 4 (as there are only 4 landscape types) as the sub tropic landscape * got two types of area, one for normal trees and one only for cacti. */ -enum { - TREE_COUNT_TEMPERATE = TREE_SUB_ARCTIC - TREE_TEMPERATE, ///< number of treetypes on a temperate map - TREE_COUNT_SUB_ARCTIC = TREE_RAINFOREST - TREE_SUB_ARCTIC, ///< number of treetypes on a sub arctic map - TREE_COUNT_RAINFOREST = TREE_CACTUS - TREE_RAINFOREST, ///< number of treetypes for the 'rainforrest part' of a sub-tropic map - TREE_COUNT_SUB_TROPICAL = TREE_TOYLAND - TREE_SUB_TROPICAL, ///< number of treetypes for the 'sub-tropic part' of a sub-tropic map - TREE_COUNT_TOYLAND = 9 ///< number of treetypes on a toyland map -}; +static const uint TREE_COUNT_TEMPERATE = TREE_SUB_ARCTIC - TREE_TEMPERATE; ///< number of treetypes on a temperate map +static const uint TREE_COUNT_SUB_ARCTIC = TREE_RAINFOREST - TREE_SUB_ARCTIC; ///< number of treetypes on a sub arctic map +static const uint TREE_COUNT_RAINFOREST = TREE_CACTUS - TREE_RAINFOREST; ///< number of treetypes for the 'rainforrest part' of a sub-tropic map +static const uint TREE_COUNT_SUB_TROPICAL = TREE_TOYLAND - TREE_SUB_TROPICAL; ///< number of treetypes for the 'sub-tropic part' of a sub-tropic map +static const uint TREE_COUNT_TOYLAND = 9; ///< number of treetypes on a toyland map /** * Enumeration for ground types of tiles with trees. diff --git a/src/vehicle_gui.h b/src/vehicle_gui.h index 07dda47fc..3d5429d29 100644 --- a/src/vehicle_gui.h +++ b/src/vehicle_gui.h @@ -47,7 +47,7 @@ enum TrainDetailsWindowTabs { }; /** Vehicle List Window type flags */ -enum { +enum VehicleListWindowType { VLW_STANDARD = 0 << 8, VLW_SHARED_ORDERS = 1 << 8, VLW_STATION_LIST = 2 << 8, diff --git a/src/vehicle_type.h b/src/vehicle_type.h index 9ebe5ed69..7e28df10a 100644 --- a/src/vehicle_type.h +++ b/src/vehicle_type.h @@ -48,7 +48,7 @@ struct BaseVehicle static const VehicleID INVALID_VEHICLE = 0xFFFF; ///< Constant representing a non-existing vehicle. /** Pathfinding option states */ -enum { +enum VehiclePathFinders { VPF_OPF = 0, ///< The Original PathFinder (only for ships) VPF_NPF = 1, ///< New PathFinder VPF_YAPF = 2, ///< Yet Another PathFinder @@ -64,10 +64,8 @@ enum DepotCommand { DEPOT_COMMAND_MASK = 0xF, }; -enum { - MAX_LENGTH_VEHICLE_NAME_BYTES = 31, ///< The maximum length of a vehicle name in bytes including '\0' - MAX_LENGTH_VEHICLE_NAME_PIXELS = 150, ///< The maximum length of a vehicle name in pixels -}; +static const uint MAX_LENGTH_VEHICLE_NAME_BYTES = 31; ///< The maximum length of a vehicle name in bytes including '\0' +static const uint MAX_LENGTH_VEHICLE_NAME_PIXELS = 150; ///< The maximum length of a vehicle name in pixels /** Vehicle acceleration models. */ enum AccelerationModel { diff --git a/src/viewport_type.h b/src/viewport_type.h index 8f65f8506..f815712d4 100644 --- a/src/viewport_type.h +++ b/src/viewport_type.h @@ -63,10 +63,8 @@ enum ZoomStateChange { * z=6 reserved, currently unused. * z=7 Z separator between bridge/tunnel and the things under/above it. */ -enum { - BB_HEIGHT_UNDER_BRIDGE = 6, ///< Everything that can be built under low bridges, must not exceed this Z height. - BB_Z_SEPARATOR = 7, ///< Separates the bridge/tunnel from the things under/above it. -}; +static const uint BB_HEIGHT_UNDER_BRIDGE = 6; ///< Everything that can be built under low bridges, must not exceed this Z height. +static const uint BB_Z_SEPARATOR = 7; ///< Separates the bridge/tunnel from the things under/above it. /** Viewport place method (type of highlighted area and placed objects) */ enum ViewportPlaceMethod { diff --git a/src/widget_type.h b/src/widget_type.h index 4c9585eb2..fca5f3c56 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -18,9 +18,7 @@ #include "gfx_type.h" #include "window_type.h" -enum { - WIDGET_LIST_END = -1, ///< indicate the end of widgets' list for vararg functions -}; +static const int WIDGET_LIST_END = -1; ///< indicate the end of widgets' list for vararg functions /** Bits of the #WWT_MATRIX widget data. */ enum MatrixWidgetValues { -- cgit v1.2.3-70-g09d2