diff options
Diffstat (limited to 'src')
36 files changed, 64 insertions, 64 deletions
diff --git a/src/base_media_base.h b/src/base_media_base.h index da06e7841..070a33291 100644 --- a/src/base_media_base.h +++ b/src/base_media_base.h @@ -45,7 +45,7 @@ struct BaseSet { static const size_t NUM_FILES = Tnum_files; /** Internal names of the files in this set. */ - static const char **file_names; + static const char * const *file_names; const char *name; ///< The name of the base set const char *description; ///< Description of the base set diff --git a/src/callback_table.cpp b/src/callback_table.cpp index d0caf7b88..0889e7d20 100644 --- a/src/callback_table.cpp +++ b/src/callback_table.cpp @@ -67,7 +67,7 @@ CommandCallback CcCreateGroup; /* ai/ai_core.cpp */ CommandCallback CcAI; -CommandCallback *_callback_table[] = { +CommandCallback * const _callback_table[] = { /* 0x00 */ NULL, /* 0x01 */ CcBuildAircraft, /* 0x02 */ CcBuildAirport, diff --git a/src/callback_table.h b/src/callback_table.h index bf2210899..f08ba7a05 100644 --- a/src/callback_table.h +++ b/src/callback_table.h @@ -14,7 +14,7 @@ #include "command_type.h" -extern CommandCallback *_callback_table[]; +extern CommandCallback * const _callback_table[]; extern const int _callback_table_count; #endif /* CALLBACK_TABLE_H */ diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index 8bd2a745c..8cc8aaee2 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -29,7 +29,7 @@ static CommandCost ClearTile_Clear(TileIndex tile, DoCommandFlag flags) { - static const Money *clear_price_table[] = { + static const Money * const clear_price_table[] = { &_price.clear_grass, &_price.clear_roughland, &_price.clear_rocks, diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index b6f00c198..316df7a20 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -1243,7 +1243,7 @@ DEF_CONSOLE_CMD(ConScreenShot) DEF_CONSOLE_CMD(ConInfoVar) { - static const char *_icon_vartypes[] = {"boolean", "byte", "uint16", "uint32", "int16", "int32", "string"}; + static const char * const _icon_vartypes[] = {"boolean", "byte", "uint16", "uint32", "int16", "int32", "string"}; const IConsoleVar *var; if (argc == 0) { @@ -1587,7 +1587,7 @@ bool NetworkChangeCompanyPassword(byte argc, char *argv[]) /** Resolve a string to a content type. */ static ContentType StringToContentType(const char *str) { - static const char *inv_lookup[] = { "", "base", "newgrf", "ai", "ailib", "scenario", "heightmap" }; + static const char * const inv_lookup[] = { "", "base", "newgrf", "ai", "ailib", "scenario", "heightmap" }; for (uint i = 1 /* there is no type 0 */; i < lengthof(inv_lookup); i++) { if (strcasecmp(str, inv_lookup[i]) == 0) return (ContentType)i; } @@ -1670,9 +1670,9 @@ DEF_CONSOLE_CMD(ConContent) if (strcasecmp(argv[1], "state") == 0) { IConsolePrintF(CC_WHITE, "id, type, state, name"); for (ConstContentIterator iter = _network_content_client.Begin(); iter != _network_content_client.End(); iter++) { - static const char *types[] = { "Base graphics", "NewGRF", "AI", "AI library", "Scenario", "Heightmap" }; - static const char *states[] = { "Not selected", "Selected" , "Dep Selected", "Installed", "Unknown" }; - static ConsoleColour state_to_colour[] = { CC_COMMAND, CC_INFO, CC_INFO, CC_WHITE, CC_ERROR }; + static const char * const types[] = { "Base graphics", "NewGRF", "AI", "AI library", "Scenario", "Heightmap" }; + static const char * const states[] = { "Not selected", "Selected" , "Dep Selected", "Installed", "Unknown" }; + static const ConsoleColour state_to_colour[] = { CC_COMMAND, CC_INFO, CC_INFO, CC_WHITE, CC_ERROR }; const ContentInfo *ci = *iter; IConsolePrintF(state_to_colour[ci->state], "%d, %s, %s, %s", ci->id, types[ci->type - 1], states[ci->state], ci->name); diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 60365f7ae..770ac2cab 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -175,7 +175,7 @@ uint _block_sizes[4][2]; /* Array to hold the default resize capacities * First part is the vehicle type, while the last is 0 = x, 1 = y */ -const uint _resize_cap[][2] = { +static const uint _resize_cap[][2] = { /* VEH_TRAIN */ {6, 10 * 29}, /* VEH_ROAD */ {5, 5}, /* VEH_SHIP */ {3, 3}, diff --git a/src/gamelog.cpp b/src/gamelog.cpp index 660bed726..17bc58cc4 100644 --- a/src/gamelog.cpp +++ b/src/gamelog.cpp @@ -139,7 +139,7 @@ static void PrintGrfInfo(char *buf, uint grfid, const uint8 *md5sum) /** Text messages for various logged actions */ -static const char *la_text[] = { +static const char * const la_text[] = { "new game started", "game loaded", "GRF config changed", diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index e20204bcb..1a722a9a8 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -252,11 +252,11 @@ MD5File::ChecksumResult MD5File::CheckMD5() const } /** Names corresponding to the GraphicsFileType */ -const char *_graphics_file_names[] = { "base", "logos", "arctic", "tropical", "toyland", "extra" }; +static const char * const _graphics_file_names[] = { "base", "logos", "arctic", "tropical", "toyland", "extra" }; /** Implementation */ template <class T, size_t Tnum_files> -/* static */ const char **BaseSet<T, Tnum_files>::file_names = _graphics_file_names; +/* static */ const char * const *BaseSet<T, Tnum_files>::file_names = _graphics_file_names; extern void UpdateNewGRFConfigPalette(); diff --git a/src/ini.cpp b/src/ini.cpp index 7167436f8..f65cf45e6 100644 --- a/src/ini.cpp +++ b/src/ini.cpp @@ -98,7 +98,7 @@ void IniGroup::Clear() this->last_item = &this->item; } -IniFile::IniFile(const char **list_group_names) : group(NULL), comment(NULL), list_group_names(list_group_names) +IniFile::IniFile(const char * const *list_group_names) : group(NULL), comment(NULL), list_group_names(list_group_names) { this->last_group = &this->group; } diff --git a/src/ini_type.h b/src/ini_type.h index 2ee914629..45cd75b00 100644 --- a/src/ini_type.h +++ b/src/ini_type.h @@ -80,17 +80,17 @@ struct IniGroup { /** The complete ini file. */ struct IniFile { - IniGroup *group; ///< the first group in the ini - IniGroup **last_group; ///< the last group in the ini - char *comment; ///< last comment in file - const char **list_group_names; ///< NULL terminated list with group names that are lists + IniGroup *group; ///< the first group in the ini + IniGroup **last_group; ///< the last group in the ini + char *comment; ///< last comment in file + const char * const *list_group_names; ///< NULL terminated list with group names that are lists /** * Construct a new in-memory Ini file representation. * @param list_group_names A NULL terminated list with groups that should be * loaded as lists instead of variables. */ - IniFile(const char **list_group_names = NULL); + IniFile(const char * const *list_group_names = NULL); /** Free everything we loaded. */ ~IniFile(); diff --git a/src/map.cpp b/src/map.cpp index 39cadfd64..e6b0dcb42 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -282,7 +282,7 @@ bool CircularTileSearch(TileIndex *tile, uint radius, uint w, uint h, TestTileOn uint x = TileX(*tile) + w + 1; uint y = TileY(*tile); - uint extent[DIAGDIR_END] = { w, h, w, h }; + const uint extent[DIAGDIR_END] = { w, h, w, h }; for (uint n = 0; n < radius; n++) { for (DiagDirection dir = DIAGDIR_BEGIN; dir < DIAGDIR_END; dir++) { diff --git a/src/misc/dbg_helpers.cpp b/src/misc/dbg_helpers.cpp index 4af243888..6a98680dc 100644 --- a/src/misc/dbg_helpers.cpp +++ b/src/misc/dbg_helpers.cpp @@ -14,7 +14,7 @@ #include "dbg_helpers.h" /** Trackdir & TrackdirBits short names. */ -static const char *trackdir_names[] = { +static const char * const trackdir_names[] = { "NE", "SE", "UE", "LE", "LS", "RS", "rne", "rse", "SW", "NW", "UW", "LW", "LN", "RN", "rsw", "rnw", }; @@ -37,7 +37,7 @@ CStrA ValueStr(TrackdirBits td_bits) /** DiagDirection short names. */ -static const char *diagdir_names[] = { +static const char * const diagdir_names[] = { "NE", "SE", "SW", "NW", }; @@ -51,7 +51,7 @@ CStrA ValueStr(DiagDirection dd) /** SignalType short names. */ -static const char *signal_type_names[] = { +static const char * const signal_type_names[] = { "NORMAL", "ENTRY", "EXIT", "COMBO", "PBS", "NOENTRY", }; diff --git a/src/misc/dbg_helpers.h b/src/misc/dbg_helpers.h index 73175f201..56eebb247 100644 --- a/src/misc/dbg_helpers.h +++ b/src/misc/dbg_helpers.h @@ -34,7 +34,7 @@ template <typename T, size_t N> struct ArrayT<T[N]> { * or t_unk when index is out of bounds. */ template <typename E, typename T> -inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_t t_unk) +inline typename ArrayT<T>::item_t ItemAtT(E idx, const T &t, typename ArrayT<T>::item_t t_unk) { if ((size_t)idx >= ArrayT<T>::length) { return t_unk; @@ -48,7 +48,7 @@ inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_ * or t_unk when index is out of bounds. */ template <typename E, typename T> -inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_t t_unk, E idx_inv, typename ArrayT<T>::item_t t_inv) +inline typename ArrayT<T>::item_t ItemAtT(E idx, const T &t, typename ArrayT<T>::item_t t_unk, E idx_inv, typename ArrayT<T>::item_t t_inv) { if ((size_t)idx < ArrayT<T>::length) { return t[idx]; diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 8af441fd0..6deb164a8 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -348,7 +348,7 @@ static const WindowDesc _about_desc( NULL, _nested_about_widgets, lengthof(_nested_about_widgets) ); -static const char *_credits[] = { +static const char * const _credits[] = { "Original design by Chris Sawyer", "Original graphics by Simon Foster", "", diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 0fd6ddd27..12a3aacb4 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -824,7 +824,7 @@ static const Widget _network_game_window_widgets[] = { * display_flags and/or left/right side for the overlapping widgets * NGWW_CLIENTS through NGWW_YEARS. */ -NWidgetPart _nested_network_game_widgets[] = { +static const NWidgetPart _nested_network_game_widgets[] = { /* TOP */ NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE, NGWW_CLOSE), diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 5b94adfff..01e080b74 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -5644,7 +5644,7 @@ static const CargoLabel _default_refitmasks_aircraft[] = { 'TOYS', 'BATT', 'SWET', 'TOFF', 'COLA', 'CTCD', 'BUBL', 'PLST', 'FZDR', 0 }; -static const CargoLabel *_default_refitmasks[] = { +static const CargoLabel * const _default_refitmasks[] = { _default_refitmasks_rail, _default_refitmasks_road, _default_refitmasks_ships, diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 86c1de53a..393b3c841 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -53,7 +53,7 @@ void ResetRailTypes() memcpy(_railtypes, _original_railtypes, sizeof(_original_railtypes)); } -const byte _track_sloped_sprites[14] = { +static const byte _track_sloped_sprites[14] = { 14, 15, 22, 13, 0, 21, 17, 12, 23, 0, 18, 20, @@ -2292,7 +2292,7 @@ static void GetTileDesc_Track(TileIndex tile, TileDesc *td) break; case RAIL_TILE_SIGNALS: { - const StringID signal_type[6][6] = { + static const StringID signal_type[6][6] = { { STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_SIGNALS, STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_PRESIGNALS, @@ -2378,7 +2378,7 @@ static void ChangeTileOwner_Track(TileIndex tile, Owner old_owner, Owner new_own static const byte _fractcoords_behind[4] = { 0x8F, 0x8, 0x80, 0xF8 }; static const byte _fractcoords_enter[4] = { 0x8A, 0x48, 0x84, 0xA8 }; -static const signed char _deltacoord_leaveoffset[8] = { +static const int8 _deltacoord_leaveoffset[8] = { -1, 0, 1, 0, /* x */ 0, 1, 0, -1 /* y */ }; diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 1132db2af..b1a9e3006 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -1309,7 +1309,7 @@ static Trackdir FollowPreviousRoadVehicle(const RoadVehicle *v, const RoadVehicl * going over the trackdirs used for turning 90 degrees, i.e. * TRACKDIR_{UPPER,RIGHT,LOWER,LEFT}_{N,E,S,W}. */ - Trackdir reversed_turn_lookup[2][DIAGDIR_END] = { + static const Trackdir reversed_turn_lookup[2][DIAGDIR_END] = { { TRACKDIR_UPPER_W, TRACKDIR_RIGHT_N, TRACKDIR_LEFT_N, TRACKDIR_UPPER_E }, { TRACKDIR_RIGHT_S, TRACKDIR_LOWER_W, TRACKDIR_LOWER_E, TRACKDIR_LEFT_S }}; dir = reversed_turn_lookup[prev->tile < tile ? 0 : 1][ReverseDiagDir(entry_dir)]; diff --git a/src/saveload/gamelog_sl.cpp b/src/saveload/gamelog_sl.cpp index a77a930ed..dc0bebc5d 100644 --- a/src/saveload/gamelog_sl.cpp +++ b/src/saveload/gamelog_sl.cpp @@ -87,7 +87,7 @@ static const SaveLoad _glog_emergency_desc[] = { SLE_END() }; -static const SaveLoad *_glog_desc[] = { +static const SaveLoad * const _glog_desc[] = { _glog_mode_desc, _glog_revision_desc, _glog_oldver_desc, diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp index b71d7058b..b6043f62b 100644 --- a/src/saveload/vehicle_sl.cpp +++ b/src/saveload/vehicle_sl.cpp @@ -669,7 +669,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt) }; - static const SaveLoad *_veh_descs[] = { + static const SaveLoad * const _veh_descs[] = { _train_desc, _roadveh_desc, _ship_desc, diff --git a/src/settings.cpp b/src/settings.cpp index ba7cec8ad..6fed56818 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -86,7 +86,7 @@ static bool IsSignedVarMemType(VarType vt); /** * Groups in openttd.cfg that are actually lists. */ -static const char *_list_group_names[] = { +static const char * const _list_group_names[] = { "bans", "newgrf", "servers", @@ -1256,7 +1256,7 @@ static void SaveVersionInConfig(IniFile *ini) char version[9]; snprintf(version, lengthof(version), "%08X", _openttd_newgrf_version); - const char *versions[][2] = { + const char * const versions[][2] = { { "version_string", _openttd_revision }, { "version_number", version } }; diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 850f92933..dd8228b63 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -519,7 +519,7 @@ static const uint32 _smallmap_mask_right[] = { /* each tile has 4 x pixels and 1 y pixel */ -static GetSmallMapPixels *_smallmap_draw_procs[] = { +static GetSmallMapPixels * const _smallmap_draw_procs[] = { GetSmallMapContoursPixels, GetSmallMapVehiclesPixels, GetSmallMapIndustriesPixels, diff --git a/src/sound.cpp b/src/sound.cpp index 10d48d0c3..80eb8f2ea 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -271,11 +271,11 @@ void SndPlayFx(SoundID sound) INSTANTIATE_BASE_MEDIA_METHODS(BaseMedia<SoundsSet>, SoundsSet) /** Names corresponding to the sound set's files */ -const char *_sound_file_names[] = { "samples" }; +static const char * const _sound_file_names[] = { "samples" }; template <class T, size_t Tnum_files> -/* static */ const char **BaseSet<T, Tnum_files>::file_names = _sound_file_names; +/* static */ const char * const *BaseSet<T, Tnum_files>::file_names = _sound_file_names; template <class Tbase_set> /* static */ const char *BaseMedia<Tbase_set>::GetExtension() diff --git a/src/spritecache.cpp b/src/spritecache.cpp index 991347552..a9a99fbb2 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -498,7 +498,7 @@ void *AllocSprite(size_t mem_req) * @note this function will do usererror() in the case the fallback sprite isn't available */ static void *HandleInvalidSpriteRequest(SpriteID sprite, SpriteType requested, SpriteCache *sc) { - static const char *sprite_types[] = { + static const char * const sprite_types[] = { "normal", // ST_NORMAL "map generator", // ST_MAPGEN "character", // ST_FONT diff --git a/src/table/elrail_data.h b/src/table/elrail_data.h index a40fcaa92..55725a249 100644 --- a/src/table/elrail_data.h +++ b/src/table/elrail_data.h @@ -38,7 +38,7 @@ enum { }; /** Which PPPs are possible at all on a given PCP */ -static byte AllowedPPPonPCP[DIAGDIR_END] = { +static const byte AllowedPPPonPCP[DIAGDIR_END] = { 1 << DIR_N | 1 << DIR_E | 1 << DIR_SE | 1 << DIR_S | 1 << DIR_W | 1 << DIR_NW, 1 << DIR_N | 1 << DIR_NE | 1 << DIR_E | 1 << DIR_S | 1 << DIR_SW | 1 << DIR_W, 1 << DIR_N | 1 << DIR_E | 1 << DIR_SE | 1 << DIR_S | 1 << DIR_W | 1 << DIR_NW, @@ -48,7 +48,7 @@ static byte AllowedPPPonPCP[DIAGDIR_END] = { /** Which of the PPPs are inside the tile. For the two PPPs on the tile border * the following system is used: if you rotate the PCP so that it is in the * north, the eastern PPP belongs to the tile. */ -static byte OwnedPPPonPCP[DIAGDIR_END] = { +static const byte OwnedPPPonPCP[DIAGDIR_END] = { 1 << DIR_SE | 1 << DIR_S | 1 << DIR_SW | 1 << DIR_W, 1 << DIR_N | 1 << DIR_SW | 1 << DIR_W | 1 << DIR_NW, 1 << DIR_N | 1 << DIR_NE | 1 << DIR_E | 1 << DIR_NW, @@ -70,7 +70,7 @@ static const DiagDirection PCPpositions[TRACK_END][2] = { * track, plus the point in extension of the track (to mark end-of-track). PCPs * which are not on either end of the track are fully preferred. * @see PCPpositions */ -static byte PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = { +static const byte PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = { { // X 1 << DIR_NE | 1 << DIR_SE | 1 << DIR_NW, // NE PCP_NOT_ON_TRACK, // SE @@ -111,7 +111,7 @@ static byte PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = { /** In case we have a staight line, we place pylon only every two tiles, * so there are certain tiles which we ignore. A straight line is found if * we have exactly two PPPs. */ -static byte IgnoredPCP[NUM_IGNORE_GROUPS][TLG_END][DIAGDIR_END] = { +static const byte IgnoredPCP[NUM_IGNORE_GROUPS][TLG_END][DIAGDIR_END] = { { // Ignore group 1, X and Y tracks { // X even, Y even IGNORE_NONE, @@ -186,7 +186,7 @@ static byte IgnoredPCP[NUM_IGNORE_GROUPS][TLG_END][DIAGDIR_END] = { #undef NO_IGNORE /** Which pylons can definately NOT be built */ -static byte DisallowedPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = { +static const byte DisallowedPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = { {1 << DIR_SW | 1 << DIR_NE, 0, 1 << DIR_SW | 1 << DIR_NE, 0 }, // X {0, 1 << DIR_NW | 1 << DIR_SE, 0, 1 << DIR_NW | 1 << DIR_SE}, // Y {1 << DIR_W | 1 << DIR_E, 0, 0, 1 << DIR_W | 1 << DIR_E }, // UPPER diff --git a/src/table/pricebase.h b/src/table/pricebase.h index 8876c6b43..364dd3f82 100644 --- a/src/table/pricebase.h +++ b/src/table/pricebase.h @@ -9,7 +9,7 @@ /** @file pricebase.h Price Bases */ -static PriceBaseSpec _price_base_specs[NUM_PRICES] = { +static const PriceBaseSpec _price_base_specs[NUM_PRICES] = { { 100, PCAT_NONE }, ///< station_value { 100, PCAT_CONSTRUCTION}, ///< build_rail { 95, PCAT_CONSTRUCTION}, ///< build_road diff --git a/src/table/station_land.h b/src/table/station_land.h index 5726dd57d..f6264e537 100644 --- a/src/table/station_land.h +++ b/src/table/station_land.h @@ -967,7 +967,7 @@ static const DrawTileSprites _station_display_datas_waypoint[] = { #undef TILE_SPRITE_LINE -static const DrawTileSprites *_station_display_datas[] = { +static const DrawTileSprites * const _station_display_datas[] = { _station_display_datas_rail, _station_display_datas_airport, _station_display_datas_truck, diff --git a/src/table/strgen_tables.h b/src/table/strgen_tables.h index 2e2eb95e6..8aae5cf3e 100644 --- a/src/table/strgen_tables.h +++ b/src/table/strgen_tables.h @@ -184,7 +184,7 @@ static const PluralForm _plural_forms[] = { * a = array, i.e. list of strings */ /** All pragmas used */ -static const char *_pragmas[][4] = { +static const char * const _pragmas[][4] = { /* name flags default description */ { "name", "0", "", "English name for the language" }, { "ownname", "t", "", "Localised name for the language" }, diff --git a/src/table/unicode.h b/src/table/unicode.h index 05eaa5f67..4c7f45107 100644 --- a/src/table/unicode.h +++ b/src/table/unicode.h @@ -24,7 +24,7 @@ enum { * exist, or are in the wrong place, in the standard sprite fonts. * This is not used for FreeType rendering */ -static DefaultUnicodeMapping _default_unicode_map[] = { +static const DefaultUnicodeMapping _default_unicode_map[] = { { 0x00A0, 0x20 }, // Non-breaking space / Up arrow { 0x00A4, CLRL }, // Currency sign { 0x00A6, CLRL }, // Broken bar diff --git a/src/table/unmovable_land.h b/src/table/unmovable_land.h index bafbb8bdb..7a10e3773 100644 --- a/src/table/unmovable_land.h +++ b/src/table/unmovable_land.h @@ -100,10 +100,10 @@ static const DrawTileSprites _unmovable_display_datas[] = { #undef TILE_SPRITE_LINE -const UnmovableSpec _original_unmovable[] = { +static const UnmovableSpec _original_unmovable[] = { {STR_LAI_UNMOVABLE_DESCRIPTION_TRANSMITTER, 1, 1}, {STR_LAI_UNMOVABLE_DESCRIPTION_LIGHTHOUSE, 1, 1}, - {STR_TOWN_BUILDING_NAME_STATUE_1, 1, 1}, + {STR_TOWN_BUILDING_NAME_STATUE_1, 1, 1}, {STR_LAI_UNMOVABLE_DESCRIPTION_COMPANY_OWNED_LAND, 10, 2}, {STR_LAI_UNMOVABLE_DESCRIPTION_COMPANY_HEADQUARTERS, 1, 1}, }; diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index cd3a06abb..8814e97e6 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -935,7 +935,7 @@ static void SplitToolbar(Window *w) 0, 1, 3, 4, 7, 8, 9, 10, 12, 25, 19, 20, 21, 22, 23, 26, 17, 18, 27, }; - static const byte *arrangements[] = { arrange14, arrange15, arrange16, arrange17, arrange18, arrange19 }; + static const byte * const arrangements[] = { arrange14, arrange15, arrange16, arrange17, arrange18, arrange19 }; uint max_icons = max(TBP_TOOLBAR_MINBUTTON, (ToolBarProperties)((w->width + TBP_BUTTONWIDTH / 2) / TBP_BUTTONWIDTH)); diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 08494c51f..a94620ee5 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -322,13 +322,13 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u if (transport_type == TRANSPORT_WATER && (tileh_start == SLOPE_FLAT || tileh_end == SLOPE_FLAT)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION); - TileIndex Heads[] = {tile_start, tile_end}; + const TileIndex heads[] = {tile_start, tile_end}; for (int i = 0; i < 2; i++) { - if (MayHaveBridgeAbove(Heads[i])) { - if (IsBridgeAbove(Heads[i])) { - TileIndex north_head = GetNorthernBridgeEnd(Heads[i]); + if (MayHaveBridgeAbove(heads[i])) { + if (IsBridgeAbove(heads[i])) { + TileIndex north_head = GetNorthernBridgeEnd(heads[i]); - if (direction == GetBridgeAxis(Heads[i])) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); + if (direction == GetBridgeAxis(heads[i])) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); if (z_start + TILE_HEIGHT == GetBridgeHeight(north_head)) { return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); diff --git a/src/yapf/yapf_common.hpp b/src/yapf/yapf_common.hpp index 73d461ed9..51c2fc12a 100644 --- a/src/yapf/yapf_common.hpp +++ b/src/yapf/yapf_common.hpp @@ -150,8 +150,8 @@ public: * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ inline bool PfCalcEstimate(Node& n) { - static int dg_dir_to_x_offs[] = {-1, 0, 1, 0}; - static int dg_dir_to_y_offs[] = {0, 1, 0, -1}; + static const int dg_dir_to_x_offs[] = {-1, 0, 1, 0}; + static const int dg_dir_to_y_offs[] = {0, 1, 0, -1}; if (PfDetectDestination(n)) { n.m_estimate = n.m_cost; return true; diff --git a/src/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp index 405c8e6c0..acdc68244 100644 --- a/src/yapf/yapf_destrail.hpp +++ b/src/yapf/yapf_destrail.hpp @@ -176,8 +176,8 @@ public: * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ FORCEINLINE bool PfCalcEstimate(Node& n) { - static int dg_dir_to_x_offs[] = {-1, 0, 1, 0}; - static int dg_dir_to_y_offs[] = {0, 1, 0, -1}; + static const int dg_dir_to_x_offs[] = {-1, 0, 1, 0}; + static const int dg_dir_to_y_offs[] = {0, 1, 0, -1}; if (PfDetectDestination(n)) { n.m_estimate = n.m_cost; return true; diff --git a/src/yapf/yapf_node_rail.hpp b/src/yapf/yapf_node_rail.hpp index fb8d1cf86..597424e0a 100644 --- a/src/yapf/yapf_node_rail.hpp +++ b/src/yapf/yapf_node_rail.hpp @@ -119,7 +119,7 @@ DECLARE_ENUM_AS_BIT_SET(EndSegmentReasonBits); inline CStrA ValueStr(EndSegmentReasonBits bits) { - static const char *end_segment_reason_names[] = { + static const char * const end_segment_reason_names[] = { "DEAD_END", "RAIL_TYPE", "INFINITE_LOOP", "SEGMENT_TOO_LONG", "CHOICE_FOLLOWS", "DEPOT", "WAYPOINT", "STATION", "SAFE_TILE", "PATH_TOO_LONG", "FIRST_TWO_WAY_RED", "LOOK_AHEAD_END", "TARGET_REACHED" diff --git a/src/yapf/yapf_road.cpp b/src/yapf/yapf_road.cpp index 076a067d2..63cce55d2 100644 --- a/src/yapf/yapf_road.cpp +++ b/src/yapf/yapf_road.cpp @@ -304,8 +304,8 @@ public: * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ inline bool PfCalcEstimate(Node& n) { - static int dg_dir_to_x_offs[] = {-1, 0, 1, 0}; - static int dg_dir_to_y_offs[] = {0, 1, 0, -1}; + static const int dg_dir_to_x_offs[] = {-1, 0, 1, 0}; + static const int dg_dir_to_y_offs[] = {0, 1, 0, -1}; if (PfDetectDestination(n)) { n.m_estimate = n.m_cost; return true; |