changeset 13096:e3e4c1648e0c draft

(svn r17596) -Codechange: constify some tables
author smatz <smatz@openttd.org>
date Sun, 20 Sep 2009 23:11:01 +0000
parents d7e19462f08c
children b8fa1dbb5e89
files src/base_media_base.h src/callback_table.cpp src/callback_table.h src/clear_cmd.cpp src/console_cmds.cpp src/depot_gui.cpp src/gamelog.cpp src/gfxinit.cpp src/ini.cpp src/ini_type.h src/map.cpp src/misc/dbg_helpers.cpp src/misc/dbg_helpers.h src/misc_gui.cpp src/network/network_gui.cpp src/newgrf.cpp src/rail_cmd.cpp src/roadveh_cmd.cpp src/saveload/gamelog_sl.cpp src/saveload/vehicle_sl.cpp src/settings.cpp src/smallmap_gui.cpp src/sound.cpp src/spritecache.cpp src/table/elrail_data.h src/table/pricebase.h src/table/station_land.h src/table/strgen_tables.h src/table/unicode.h src/table/unmovable_land.h src/toolbar_gui.cpp src/tunnelbridge_cmd.cpp src/yapf/yapf_common.hpp src/yapf/yapf_destrail.hpp src/yapf/yapf_node_rail.hpp src/yapf/yapf_road.cpp
diffstat 36 files changed, 64 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/src/base_media_base.h
+++ b/src/base_media_base.h
@@ -45,7 +45,7 @@
 	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
--- a/src/callback_table.cpp
+++ b/src/callback_table.cpp
@@ -67,7 +67,7 @@
 /* ai/ai_core.cpp */
 CommandCallback CcAI;
 
-CommandCallback *_callback_table[] = {
+CommandCallback * const _callback_table[] = {
 	/* 0x00 */ NULL,
 	/* 0x01 */ CcBuildAircraft,
 	/* 0x02 */ CcBuildAirport,
--- 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 */
--- 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,
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -1243,7 +1243,7 @@
 
 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 @@
 /** 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 @@
 	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);
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -175,7 +175,7 @@
 
 /* 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},
--- a/src/gamelog.cpp
+++ b/src/gamelog.cpp
@@ -139,7 +139,7 @@
 
 
 /** 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",
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -252,11 +252,11 @@
 }
 
 /** 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();
 
--- a/src/ini.cpp
+++ b/src/ini.cpp
@@ -98,7 +98,7 @@
 	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;
 }
--- a/src/ini_type.h
+++ b/src/ini_type.h
@@ -80,17 +80,17 @@
 
 /** 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();
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -282,7 +282,7 @@
 	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++) {
--- 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 @@
 
 
 /** DiagDirection short names. */
-static const char *diagdir_names[] = {
+static const char * const diagdir_names[] = {
 	"NE", "SE", "SW", "NW",
 };
 
@@ -51,7 +51,7 @@
 
 
 /** SignalType short names. */
-static const char *signal_type_names[] = {
+static const char * const signal_type_names[] = {
 	"NORMAL", "ENTRY", "EXIT", "COMBO", "PBS", "NOENTRY",
 };
 
--- a/src/misc/dbg_helpers.h
+++ b/src/misc/dbg_helpers.h
@@ -34,7 +34,7 @@
  * 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 @@
  * 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];
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -348,7 +348,7 @@
 	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",
 	"",
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -824,7 +824,7 @@
  * 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),
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -5644,7 +5644,7 @@
 	'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,
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -53,7 +53,7 @@
 	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 @@
 			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 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 */
 };
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1309,7 +1309,7 @@
 			 *    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)];
--- a/src/saveload/gamelog_sl.cpp
+++ b/src/saveload/gamelog_sl.cpp
@@ -87,7 +87,7 @@
 	SLE_END()
 };
 
-static const SaveLoad *_glog_desc[] = {
+static const SaveLoad * const _glog_desc[] = {
 	_glog_mode_desc,
 	_glog_revision_desc,
 	_glog_oldver_desc,
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -669,7 +669,7 @@
 	};
 
 
-	static const SaveLoad *_veh_descs[] = {
+	static const SaveLoad * const _veh_descs[] = {
 		_train_desc,
 		_roadveh_desc,
 		_ship_desc,
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -86,7 +86,7 @@
 /**
  * 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 @@
 	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 }
 	};
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -519,7 +519,7 @@
 
 /* each tile has 4 x pixels and 1 y pixel */
 
-static GetSmallMapPixels *_smallmap_draw_procs[] = {
+static GetSmallMapPixels * const _smallmap_draw_procs[] = {
 	GetSmallMapContoursPixels,
 	GetSmallMapVehiclesPixels,
 	GetSmallMapIndustriesPixels,
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -271,11 +271,11 @@
 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()
--- a/src/spritecache.cpp
+++ b/src/spritecache.cpp
@@ -498,7 +498,7 @@
  * @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
--- a/src/table/elrail_data.h
+++ b/src/table/elrail_data.h
@@ -38,7 +38,7 @@
 };
 
 /** 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 @@
 /** 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 @@
  * 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 @@
 /** 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 @@
 #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
--- 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
--- a/src/table/station_land.h
+++ b/src/table/station_land.h
@@ -967,7 +967,7 @@
 
 #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,
--- a/src/table/strgen_tables.h
+++ b/src/table/strgen_tables.h
@@ -184,7 +184,7 @@
  * 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" },
--- a/src/table/unicode.h
+++ b/src/table/unicode.h
@@ -24,7 +24,7 @@
  * 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
--- a/src/table/unmovable_land.h
+++ b/src/table/unmovable_land.h
@@ -100,10 +100,10 @@
 
 #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},
 };
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -935,7 +935,7 @@
 		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));
 
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -322,13 +322,13 @@
 
 		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);
--- a/src/yapf/yapf_common.hpp
+++ b/src/yapf/yapf_common.hpp
@@ -150,8 +150,8 @@
 	 *  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;
--- a/src/yapf/yapf_destrail.hpp
+++ b/src/yapf/yapf_destrail.hpp
@@ -176,8 +176,8 @@
 	 *  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;
--- a/src/yapf/yapf_node_rail.hpp
+++ b/src/yapf/yapf_node_rail.hpp
@@ -119,7 +119,7 @@
 
 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"
--- a/src/yapf/yapf_road.cpp
+++ b/src/yapf/yapf_road.cpp
@@ -304,8 +304,8 @@
 	 *  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;