mirror of https://github.com/OpenTTD/OpenTTD
(svn r17596) -Codechange: constify some tables
parent
e07efc2370
commit
114d48e492
|
@ -45,7 +45,7 @@ struct BaseSet {
|
||||||
static const size_t NUM_FILES = Tnum_files;
|
static const size_t NUM_FILES = Tnum_files;
|
||||||
|
|
||||||
/** Internal names of the files in this set. */
|
/** 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 *name; ///< The name of the base set
|
||||||
const char *description; ///< Description of the base set
|
const char *description; ///< Description of the base set
|
||||||
|
|
|
@ -67,7 +67,7 @@ CommandCallback CcCreateGroup;
|
||||||
/* ai/ai_core.cpp */
|
/* ai/ai_core.cpp */
|
||||||
CommandCallback CcAI;
|
CommandCallback CcAI;
|
||||||
|
|
||||||
CommandCallback *_callback_table[] = {
|
CommandCallback * const _callback_table[] = {
|
||||||
/* 0x00 */ NULL,
|
/* 0x00 */ NULL,
|
||||||
/* 0x01 */ CcBuildAircraft,
|
/* 0x01 */ CcBuildAircraft,
|
||||||
/* 0x02 */ CcBuildAirport,
|
/* 0x02 */ CcBuildAirport,
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include "command_type.h"
|
#include "command_type.h"
|
||||||
|
|
||||||
extern CommandCallback *_callback_table[];
|
extern CommandCallback * const _callback_table[];
|
||||||
extern const int _callback_table_count;
|
extern const int _callback_table_count;
|
||||||
|
|
||||||
#endif /* CALLBACK_TABLE_H */
|
#endif /* CALLBACK_TABLE_H */
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
static CommandCost ClearTile_Clear(TileIndex tile, DoCommandFlag flags)
|
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_grass,
|
||||||
&_price.clear_roughland,
|
&_price.clear_roughland,
|
||||||
&_price.clear_rocks,
|
&_price.clear_rocks,
|
||||||
|
|
|
@ -1243,7 +1243,7 @@ DEF_CONSOLE_CMD(ConScreenShot)
|
||||||
|
|
||||||
DEF_CONSOLE_CMD(ConInfoVar)
|
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;
|
const IConsoleVar *var;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
|
@ -1587,7 +1587,7 @@ bool NetworkChangeCompanyPassword(byte argc, char *argv[])
|
||||||
/** Resolve a string to a content type. */
|
/** Resolve a string to a content type. */
|
||||||
static ContentType StringToContentType(const char *str)
|
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++) {
|
for (uint i = 1 /* there is no type 0 */; i < lengthof(inv_lookup); i++) {
|
||||||
if (strcasecmp(str, inv_lookup[i]) == 0) return (ContentType)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) {
|
if (strcasecmp(argv[1], "state") == 0) {
|
||||||
IConsolePrintF(CC_WHITE, "id, type, state, name");
|
IConsolePrintF(CC_WHITE, "id, type, state, name");
|
||||||
for (ConstContentIterator iter = _network_content_client.Begin(); iter != _network_content_client.End(); iter++) {
|
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 * const types[] = { "Base graphics", "NewGRF", "AI", "AI library", "Scenario", "Heightmap" };
|
||||||
static const char *states[] = { "Not selected", "Selected" , "Dep Selected", "Installed", "Unknown" };
|
static const char * const 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 ConsoleColour state_to_colour[] = { CC_COMMAND, CC_INFO, CC_INFO, CC_WHITE, CC_ERROR };
|
||||||
|
|
||||||
const ContentInfo *ci = *iter;
|
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);
|
IConsolePrintF(state_to_colour[ci->state], "%d, %s, %s, %s", ci->id, types[ci->type - 1], states[ci->state], ci->name);
|
||||||
|
|
|
@ -175,7 +175,7 @@ uint _block_sizes[4][2];
|
||||||
|
|
||||||
/* Array to hold the default resize capacities
|
/* Array to hold the default resize capacities
|
||||||
* First part is the vehicle type, while the last is 0 = x, 1 = y */
|
* 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_TRAIN */ {6, 10 * 29},
|
||||||
/* VEH_ROAD */ {5, 5},
|
/* VEH_ROAD */ {5, 5},
|
||||||
/* VEH_SHIP */ {3, 3},
|
/* VEH_SHIP */ {3, 3},
|
||||||
|
|
|
@ -139,7 +139,7 @@ static void PrintGrfInfo(char *buf, uint grfid, const uint8 *md5sum)
|
||||||
|
|
||||||
|
|
||||||
/** Text messages for various logged actions */
|
/** Text messages for various logged actions */
|
||||||
static const char *la_text[] = {
|
static const char * const la_text[] = {
|
||||||
"new game started",
|
"new game started",
|
||||||
"game loaded",
|
"game loaded",
|
||||||
"GRF config changed",
|
"GRF config changed",
|
||||||
|
|
|
@ -252,11 +252,11 @@ MD5File::ChecksumResult MD5File::CheckMD5() const
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Names corresponding to the GraphicsFileType */
|
/** 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 */
|
/** Implementation */
|
||||||
template <class T, size_t Tnum_files>
|
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();
|
extern void UpdateNewGRFConfigPalette();
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ void IniGroup::Clear()
|
||||||
this->last_item = &this->item;
|
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;
|
this->last_group = &this->group;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,14 +83,14 @@ struct IniFile {
|
||||||
IniGroup *group; ///< the first group in the ini
|
IniGroup *group; ///< the first group in the ini
|
||||||
IniGroup **last_group; ///< the last group in the ini
|
IniGroup **last_group; ///< the last group in the ini
|
||||||
char *comment; ///< last comment in file
|
char *comment; ///< last comment in file
|
||||||
const char **list_group_names; ///< NULL terminated list with group names that are lists
|
const char * const *list_group_names; ///< NULL terminated list with group names that are lists
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new in-memory Ini file representation.
|
* Construct a new in-memory Ini file representation.
|
||||||
* @param list_group_names A NULL terminated list with groups that should be
|
* @param list_group_names A NULL terminated list with groups that should be
|
||||||
* loaded as lists instead of variables.
|
* 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. */
|
/** Free everything we loaded. */
|
||||||
~IniFile();
|
~IniFile();
|
||||||
|
|
|
@ -282,7 +282,7 @@ bool CircularTileSearch(TileIndex *tile, uint radius, uint w, uint h, TestTileOn
|
||||||
uint x = TileX(*tile) + w + 1;
|
uint x = TileX(*tile) + w + 1;
|
||||||
uint y = TileY(*tile);
|
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 (uint n = 0; n < radius; n++) {
|
||||||
for (DiagDirection dir = DIAGDIR_BEGIN; dir < DIAGDIR_END; dir++) {
|
for (DiagDirection dir = DIAGDIR_BEGIN; dir < DIAGDIR_END; dir++) {
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "dbg_helpers.h"
|
#include "dbg_helpers.h"
|
||||||
|
|
||||||
/** Trackdir & TrackdirBits short names. */
|
/** Trackdir & TrackdirBits short names. */
|
||||||
static const char *trackdir_names[] = {
|
static const char * const trackdir_names[] = {
|
||||||
"NE", "SE", "UE", "LE", "LS", "RS", "rne", "rse",
|
"NE", "SE", "UE", "LE", "LS", "RS", "rne", "rse",
|
||||||
"SW", "NW", "UW", "LW", "LN", "RN", "rsw", "rnw",
|
"SW", "NW", "UW", "LW", "LN", "RN", "rsw", "rnw",
|
||||||
};
|
};
|
||||||
|
@ -37,7 +37,7 @@ CStrA ValueStr(TrackdirBits td_bits)
|
||||||
|
|
||||||
|
|
||||||
/** DiagDirection short names. */
|
/** DiagDirection short names. */
|
||||||
static const char *diagdir_names[] = {
|
static const char * const diagdir_names[] = {
|
||||||
"NE", "SE", "SW", "NW",
|
"NE", "SE", "SW", "NW",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ CStrA ValueStr(DiagDirection dd)
|
||||||
|
|
||||||
|
|
||||||
/** SignalType short names. */
|
/** SignalType short names. */
|
||||||
static const char *signal_type_names[] = {
|
static const char * const signal_type_names[] = {
|
||||||
"NORMAL", "ENTRY", "EXIT", "COMBO", "PBS", "NOENTRY",
|
"NORMAL", "ENTRY", "EXIT", "COMBO", "PBS", "NOENTRY",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ template <typename T, size_t N> struct ArrayT<T[N]> {
|
||||||
* or t_unk when index is out of bounds.
|
* or t_unk when index is out of bounds.
|
||||||
*/
|
*/
|
||||||
template <typename E, typename T>
|
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) {
|
if ((size_t)idx >= ArrayT<T>::length) {
|
||||||
return t_unk;
|
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.
|
* or t_unk when index is out of bounds.
|
||||||
*/
|
*/
|
||||||
template <typename E, typename T>
|
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) {
|
if ((size_t)idx < ArrayT<T>::length) {
|
||||||
return t[idx];
|
return t[idx];
|
||||||
|
|
|
@ -348,7 +348,7 @@ static const WindowDesc _about_desc(
|
||||||
NULL, _nested_about_widgets, lengthof(_nested_about_widgets)
|
NULL, _nested_about_widgets, lengthof(_nested_about_widgets)
|
||||||
);
|
);
|
||||||
|
|
||||||
static const char *_credits[] = {
|
static const char * const _credits[] = {
|
||||||
"Original design by Chris Sawyer",
|
"Original design by Chris Sawyer",
|
||||||
"Original graphics by Simon Foster",
|
"Original graphics by Simon Foster",
|
||||||
"",
|
"",
|
||||||
|
|
|
@ -824,7 +824,7 @@ static const Widget _network_game_window_widgets[] = {
|
||||||
* display_flags and/or left/right side for the overlapping widgets
|
* display_flags and/or left/right side for the overlapping widgets
|
||||||
* NGWW_CLIENTS through NGWW_YEARS.
|
* NGWW_CLIENTS through NGWW_YEARS.
|
||||||
*/
|
*/
|
||||||
NWidgetPart _nested_network_game_widgets[] = {
|
static const NWidgetPart _nested_network_game_widgets[] = {
|
||||||
/* TOP */
|
/* TOP */
|
||||||
NWidget(NWID_HORIZONTAL),
|
NWidget(NWID_HORIZONTAL),
|
||||||
NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE, NGWW_CLOSE),
|
NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE, NGWW_CLOSE),
|
||||||
|
|
|
@ -5644,7 +5644,7 @@ static const CargoLabel _default_refitmasks_aircraft[] = {
|
||||||
'TOYS', 'BATT', 'SWET', 'TOFF', 'COLA', 'CTCD', 'BUBL', 'PLST', 'FZDR',
|
'TOYS', 'BATT', 'SWET', 'TOFF', 'COLA', 'CTCD', 'BUBL', 'PLST', 'FZDR',
|
||||||
0 };
|
0 };
|
||||||
|
|
||||||
static const CargoLabel *_default_refitmasks[] = {
|
static const CargoLabel * const _default_refitmasks[] = {
|
||||||
_default_refitmasks_rail,
|
_default_refitmasks_rail,
|
||||||
_default_refitmasks_road,
|
_default_refitmasks_road,
|
||||||
_default_refitmasks_ships,
|
_default_refitmasks_ships,
|
||||||
|
|
|
@ -53,7 +53,7 @@ void ResetRailTypes()
|
||||||
memcpy(_railtypes, _original_railtypes, sizeof(_original_railtypes));
|
memcpy(_railtypes, _original_railtypes, sizeof(_original_railtypes));
|
||||||
}
|
}
|
||||||
|
|
||||||
const byte _track_sloped_sprites[14] = {
|
static const byte _track_sloped_sprites[14] = {
|
||||||
14, 15, 22, 13,
|
14, 15, 22, 13,
|
||||||
0, 21, 17, 12,
|
0, 21, 17, 12,
|
||||||
23, 0, 18, 20,
|
23, 0, 18, 20,
|
||||||
|
@ -2292,7 +2292,7 @@ static void GetTileDesc_Track(TileIndex tile, TileDesc *td)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RAIL_TILE_SIGNALS: {
|
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_SIGNALS,
|
||||||
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_PRESIGNALS,
|
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_behind[4] = { 0x8F, 0x8, 0x80, 0xF8 };
|
||||||
static const byte _fractcoords_enter[4] = { 0x8A, 0x48, 0x84, 0xA8 };
|
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 */
|
-1, 0, 1, 0, /* x */
|
||||||
0, 1, 0, -1 /* y */
|
0, 1, 0, -1 /* y */
|
||||||
};
|
};
|
||||||
|
|
|
@ -1309,7 +1309,7 @@ static Trackdir FollowPreviousRoadVehicle(const RoadVehicle *v, const RoadVehicl
|
||||||
* going over the trackdirs used for turning 90 degrees, i.e.
|
* going over the trackdirs used for turning 90 degrees, i.e.
|
||||||
* TRACKDIR_{UPPER,RIGHT,LOWER,LEFT}_{N,E,S,W}.
|
* 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_UPPER_W, TRACKDIR_RIGHT_N, TRACKDIR_LEFT_N, TRACKDIR_UPPER_E },
|
||||||
{ TRACKDIR_RIGHT_S, TRACKDIR_LOWER_W, TRACKDIR_LOWER_E, TRACKDIR_LEFT_S }};
|
{ TRACKDIR_RIGHT_S, TRACKDIR_LOWER_W, TRACKDIR_LOWER_E, TRACKDIR_LEFT_S }};
|
||||||
dir = reversed_turn_lookup[prev->tile < tile ? 0 : 1][ReverseDiagDir(entry_dir)];
|
dir = reversed_turn_lookup[prev->tile < tile ? 0 : 1][ReverseDiagDir(entry_dir)];
|
||||||
|
|
|
@ -87,7 +87,7 @@ static const SaveLoad _glog_emergency_desc[] = {
|
||||||
SLE_END()
|
SLE_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SaveLoad *_glog_desc[] = {
|
static const SaveLoad * const _glog_desc[] = {
|
||||||
_glog_mode_desc,
|
_glog_mode_desc,
|
||||||
_glog_revision_desc,
|
_glog_revision_desc,
|
||||||
_glog_oldver_desc,
|
_glog_oldver_desc,
|
||||||
|
|
|
@ -669,7 +669,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const SaveLoad *_veh_descs[] = {
|
static const SaveLoad * const _veh_descs[] = {
|
||||||
_train_desc,
|
_train_desc,
|
||||||
_roadveh_desc,
|
_roadveh_desc,
|
||||||
_ship_desc,
|
_ship_desc,
|
||||||
|
|
|
@ -86,7 +86,7 @@ static bool IsSignedVarMemType(VarType vt);
|
||||||
/**
|
/**
|
||||||
* Groups in openttd.cfg that are actually lists.
|
* Groups in openttd.cfg that are actually lists.
|
||||||
*/
|
*/
|
||||||
static const char *_list_group_names[] = {
|
static const char * const _list_group_names[] = {
|
||||||
"bans",
|
"bans",
|
||||||
"newgrf",
|
"newgrf",
|
||||||
"servers",
|
"servers",
|
||||||
|
@ -1256,7 +1256,7 @@ static void SaveVersionInConfig(IniFile *ini)
|
||||||
char version[9];
|
char version[9];
|
||||||
snprintf(version, lengthof(version), "%08X", _openttd_newgrf_version);
|
snprintf(version, lengthof(version), "%08X", _openttd_newgrf_version);
|
||||||
|
|
||||||
const char *versions[][2] = {
|
const char * const versions[][2] = {
|
||||||
{ "version_string", _openttd_revision },
|
{ "version_string", _openttd_revision },
|
||||||
{ "version_number", version }
|
{ "version_number", version }
|
||||||
};
|
};
|
||||||
|
|
|
@ -519,7 +519,7 @@ static const uint32 _smallmap_mask_right[] = {
|
||||||
|
|
||||||
/* each tile has 4 x pixels and 1 y pixel */
|
/* each tile has 4 x pixels and 1 y pixel */
|
||||||
|
|
||||||
static GetSmallMapPixels *_smallmap_draw_procs[] = {
|
static GetSmallMapPixels * const _smallmap_draw_procs[] = {
|
||||||
GetSmallMapContoursPixels,
|
GetSmallMapContoursPixels,
|
||||||
GetSmallMapVehiclesPixels,
|
GetSmallMapVehiclesPixels,
|
||||||
GetSmallMapIndustriesPixels,
|
GetSmallMapIndustriesPixels,
|
||||||
|
|
|
@ -271,11 +271,11 @@ void SndPlayFx(SoundID sound)
|
||||||
INSTANTIATE_BASE_MEDIA_METHODS(BaseMedia<SoundsSet>, SoundsSet)
|
INSTANTIATE_BASE_MEDIA_METHODS(BaseMedia<SoundsSet>, SoundsSet)
|
||||||
|
|
||||||
/** Names corresponding to the sound set's files */
|
/** 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>
|
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>
|
template <class Tbase_set>
|
||||||
/* static */ const char *BaseMedia<Tbase_set>::GetExtension()
|
/* static */ const char *BaseMedia<Tbase_set>::GetExtension()
|
||||||
|
|
|
@ -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 */
|
* @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 void *HandleInvalidSpriteRequest(SpriteID sprite, SpriteType requested, SpriteCache *sc)
|
||||||
{
|
{
|
||||||
static const char *sprite_types[] = {
|
static const char * const sprite_types[] = {
|
||||||
"normal", // ST_NORMAL
|
"normal", // ST_NORMAL
|
||||||
"map generator", // ST_MAPGEN
|
"map generator", // ST_MAPGEN
|
||||||
"character", // ST_FONT
|
"character", // ST_FONT
|
||||||
|
|
|
@ -38,7 +38,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Which PPPs are possible at all on a given PCP */
|
/** 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_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_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,
|
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
|
/** 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
|
* the following system is used: if you rotate the PCP so that it is in the
|
||||||
* north, the eastern PPP belongs to the tile. */
|
* 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_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_SW | 1 << DIR_W | 1 << DIR_NW,
|
||||||
1 << DIR_N | 1 << DIR_NE | 1 << DIR_E | 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
|
* 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.
|
* which are not on either end of the track are fully preferred.
|
||||||
* @see PCPpositions */
|
* @see PCPpositions */
|
||||||
static byte PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = {
|
static const byte PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = {
|
||||||
{ // X
|
{ // X
|
||||||
1 << DIR_NE | 1 << DIR_SE | 1 << DIR_NW, // NE
|
1 << DIR_NE | 1 << DIR_SE | 1 << DIR_NW, // NE
|
||||||
PCP_NOT_ON_TRACK, // SE
|
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,
|
/** 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
|
* so there are certain tiles which we ignore. A straight line is found if
|
||||||
* we have exactly two PPPs. */
|
* 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
|
{ // Ignore group 1, X and Y tracks
|
||||||
{ // X even, Y even
|
{ // X even, Y even
|
||||||
IGNORE_NONE,
|
IGNORE_NONE,
|
||||||
|
@ -186,7 +186,7 @@ static byte IgnoredPCP[NUM_IGNORE_GROUPS][TLG_END][DIAGDIR_END] = {
|
||||||
#undef NO_IGNORE
|
#undef NO_IGNORE
|
||||||
|
|
||||||
/** Which pylons can definately NOT be built */
|
/** 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
|
{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
|
{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
|
{1 << DIR_W | 1 << DIR_E, 0, 0, 1 << DIR_W | 1 << DIR_E }, // UPPER
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
/** @file pricebase.h Price Bases */
|
/** @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_NONE }, ///< station_value
|
||||||
{ 100, PCAT_CONSTRUCTION}, ///< build_rail
|
{ 100, PCAT_CONSTRUCTION}, ///< build_rail
|
||||||
{ 95, PCAT_CONSTRUCTION}, ///< build_road
|
{ 95, PCAT_CONSTRUCTION}, ///< build_road
|
||||||
|
|
|
@ -967,7 +967,7 @@ static const DrawTileSprites _station_display_datas_waypoint[] = {
|
||||||
|
|
||||||
#undef TILE_SPRITE_LINE
|
#undef TILE_SPRITE_LINE
|
||||||
|
|
||||||
static const DrawTileSprites *_station_display_datas[] = {
|
static const DrawTileSprites * const _station_display_datas[] = {
|
||||||
_station_display_datas_rail,
|
_station_display_datas_rail,
|
||||||
_station_display_datas_airport,
|
_station_display_datas_airport,
|
||||||
_station_display_datas_truck,
|
_station_display_datas_truck,
|
||||||
|
|
|
@ -184,7 +184,7 @@ static const PluralForm _plural_forms[] = {
|
||||||
* a = array, i.e. list of strings
|
* a = array, i.e. list of strings
|
||||||
*/
|
*/
|
||||||
/** All pragmas used */
|
/** All pragmas used */
|
||||||
static const char *_pragmas[][4] = {
|
static const char * const _pragmas[][4] = {
|
||||||
/* name flags default description */
|
/* name flags default description */
|
||||||
{ "name", "0", "", "English name for the language" },
|
{ "name", "0", "", "English name for the language" },
|
||||||
{ "ownname", "t", "", "Localised name for the language" },
|
{ "ownname", "t", "", "Localised name for the language" },
|
||||||
|
|
|
@ -24,7 +24,7 @@ enum {
|
||||||
* exist, or are in the wrong place, in the standard sprite fonts.
|
* exist, or are in the wrong place, in the standard sprite fonts.
|
||||||
* This is not used for FreeType rendering */
|
* 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
|
{ 0x00A0, 0x20 }, // Non-breaking space / Up arrow
|
||||||
{ 0x00A4, CLRL }, // Currency sign
|
{ 0x00A4, CLRL }, // Currency sign
|
||||||
{ 0x00A6, CLRL }, // Broken bar
|
{ 0x00A6, CLRL }, // Broken bar
|
||||||
|
|
|
@ -100,7 +100,7 @@ static const DrawTileSprites _unmovable_display_datas[] = {
|
||||||
|
|
||||||
#undef TILE_SPRITE_LINE
|
#undef TILE_SPRITE_LINE
|
||||||
|
|
||||||
const UnmovableSpec _original_unmovable[] = {
|
static const UnmovableSpec _original_unmovable[] = {
|
||||||
{STR_LAI_UNMOVABLE_DESCRIPTION_TRANSMITTER, 1, 1},
|
{STR_LAI_UNMOVABLE_DESCRIPTION_TRANSMITTER, 1, 1},
|
||||||
{STR_LAI_UNMOVABLE_DESCRIPTION_LIGHTHOUSE, 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},
|
||||||
|
|
|
@ -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,
|
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));
|
uint max_icons = max(TBP_TOOLBAR_MINBUTTON, (ToolBarProperties)((w->width + TBP_BUTTONWIDTH / 2) / TBP_BUTTONWIDTH));
|
||||||
|
|
||||||
|
|
|
@ -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);
|
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++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (MayHaveBridgeAbove(Heads[i])) {
|
if (MayHaveBridgeAbove(heads[i])) {
|
||||||
if (IsBridgeAbove(Heads[i])) {
|
if (IsBridgeAbove(heads[i])) {
|
||||||
TileIndex north_head = GetNorthernBridgeEnd(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)) {
|
if (z_start + TILE_HEIGHT == GetBridgeHeight(north_head)) {
|
||||||
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||||
|
|
|
@ -150,8 +150,8 @@ public:
|
||||||
* adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
|
* adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
|
||||||
inline bool PfCalcEstimate(Node& n)
|
inline bool PfCalcEstimate(Node& n)
|
||||||
{
|
{
|
||||||
static int dg_dir_to_x_offs[] = {-1, 0, 1, 0};
|
static const 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_y_offs[] = {0, 1, 0, -1};
|
||||||
if (PfDetectDestination(n)) {
|
if (PfDetectDestination(n)) {
|
||||||
n.m_estimate = n.m_cost;
|
n.m_estimate = n.m_cost;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -176,8 +176,8 @@ public:
|
||||||
* adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
|
* adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
|
||||||
FORCEINLINE bool PfCalcEstimate(Node& n)
|
FORCEINLINE bool PfCalcEstimate(Node& n)
|
||||||
{
|
{
|
||||||
static int dg_dir_to_x_offs[] = {-1, 0, 1, 0};
|
static const 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_y_offs[] = {0, 1, 0, -1};
|
||||||
if (PfDetectDestination(n)) {
|
if (PfDetectDestination(n)) {
|
||||||
n.m_estimate = n.m_cost;
|
n.m_estimate = n.m_cost;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -119,7 +119,7 @@ DECLARE_ENUM_AS_BIT_SET(EndSegmentReasonBits);
|
||||||
|
|
||||||
inline CStrA ValueStr(EndSegmentReasonBits bits)
|
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",
|
"DEAD_END", "RAIL_TYPE", "INFINITE_LOOP", "SEGMENT_TOO_LONG", "CHOICE_FOLLOWS",
|
||||||
"DEPOT", "WAYPOINT", "STATION", "SAFE_TILE",
|
"DEPOT", "WAYPOINT", "STATION", "SAFE_TILE",
|
||||||
"PATH_TOO_LONG", "FIRST_TWO_WAY_RED", "LOOK_AHEAD_END", "TARGET_REACHED"
|
"PATH_TOO_LONG", "FIRST_TWO_WAY_RED", "LOOK_AHEAD_END", "TARGET_REACHED"
|
||||||
|
|
|
@ -304,8 +304,8 @@ public:
|
||||||
* adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
|
* adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
|
||||||
inline bool PfCalcEstimate(Node& n)
|
inline bool PfCalcEstimate(Node& n)
|
||||||
{
|
{
|
||||||
static int dg_dir_to_x_offs[] = {-1, 0, 1, 0};
|
static const 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_y_offs[] = {0, 1, 0, -1};
|
||||||
if (PfDetectDestination(n)) {
|
if (PfDetectDestination(n)) {
|
||||||
n.m_estimate = n.m_cost;
|
n.m_estimate = n.m_cost;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue