summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-05-13 10:14:29 +0000
committerrubidium <rubidium@openttd.org>2010-05-13 10:14:29 +0000
commit062dd0e24c283f210216ede06bbde0ed72c7ed25 (patch)
treea917e975f1f5d4c144ecad2c799cf58764a1f592 /src
parenta2d6961ab3c9aa43b95dfe9fa4699d290e5627e2 (diff)
downloadopenttd-062dd0e24c283f210216ede06bbde0ed72c7ed25.tar.xz
(svn r19814) -Codechange: give some more unnamed enums a name, in case they consisted of unrelated values use static const (u)int
Diffstat (limited to 'src')
-rw-r--r--src/ai/ai_instance.cpp4
-rw-r--r--src/airport.h15
-rw-r--r--src/airport_gui.cpp2
-rw-r--r--src/company_gui.cpp8
-rw-r--r--src/console_gui.cpp13
-rw-r--r--src/currency.cpp2
-rw-r--r--src/date.cpp2
-rw-r--r--src/fontcache.cpp6
-rw-r--r--src/gamelog.cpp6
-rw-r--r--src/gfx.cpp7
-rw-r--r--src/industry_cmd.cpp6
-rw-r--r--src/misc_gui.cpp6
-rw-r--r--src/music/qtmidi.cpp10
-rw-r--r--src/network/network_chat_gui.cpp4
-rw-r--r--src/network/network_content_gui.cpp6
-rw-r--r--src/network/network_gamelist.cpp8
-rw-r--r--src/network/network_udp.cpp8
-rw-r--r--src/newgrf.cpp6
-rw-r--r--src/newgrf_engine.cpp4
-rw-r--r--src/newgrf_gui.cpp6
-rw-r--r--src/newgrf_station.cpp4
-rw-r--r--src/osk_gui.cpp2
-rw-r--r--src/pathfinder/npf/npf.cpp26
-rw-r--r--src/rail_cmd.cpp2
-rw-r--r--src/signal.cpp10
-rw-r--r--src/statusbar_gui.cpp10
-rw-r--r--src/toolbar_gui.cpp8
-rw-r--r--src/train_gui.cpp8
-rw-r--r--src/video/allegro_v.cpp6
-rw-r--r--src/video/cocoa/event.mm2
30 files changed, 82 insertions, 125 deletions
diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp
index 693d76c3a..4a0924995 100644
--- a/src/ai/ai_instance.cpp
+++ b/src/ai/ai_instance.cpp
@@ -460,9 +460,7 @@ static const SaveLoad _ai_byte[] = {
SLE_END()
};
-enum {
- AISAVE_MAX_DEPTH = 25, ///< The maximum recursive depth for items stored in the savegame.
-};
+static const uint AISAVE_MAX_DEPTH = 25; ///< The maximum recursive depth for items stored in the savegame.
/* static */ bool AIInstance::SaveObject(HSQUIRRELVM vm, SQInteger index, int max_depth, bool test)
{
diff --git a/src/airport.h b/src/airport.h
index 7a0cdf54a..0733c9ab2 100644
--- a/src/airport.h
+++ b/src/airport.h
@@ -16,14 +16,13 @@
#include "tile_type.h"
/** Some airport-related constants */
-enum {
- MAX_TERMINALS = 10, ///< maximum number of terminals per airport
- MAX_HELIPADS = 4, ///< maximum number of helipads per airport
- MAX_ELEMENTS = 255, ///< maximum number of aircraft positions at airport
- NUM_AIRPORTTILES = 256, ///< total number of airport tiles
- NEW_AIRPORTTILE_OFFSET = 74, ///< offset of first newgrf airport tile
- INVALID_AIRPORTTILE = NUM_AIRPORTTILES, ///< id for an invalid airport tile
-};
+static const uint MAX_TERMINALS = 10; ///< maximum number of terminals per airport
+static const uint MAX_HELIPADS = 4; ///< maximum number of helipads per airport
+static const uint MAX_ELEMENTS = 255; ///< maximum number of aircraft positions at airport
+
+static const uint NUM_AIRPORTTILES = 256; ///< total number of airport tiles
+static const uint NEW_AIRPORTTILE_OFFSET = 74; ///< offset of first newgrf airport tile
+static const uint INVALID_AIRPORTTILE = NUM_AIRPORTTILES; ///< id for an invalid airport tile
/** Airport types */
enum AirportTypes {
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index c6c076b75..336c3ea6f 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -56,7 +56,7 @@ static void PlaceAirport(TileIndex tile)
}
/** Widget number of the airport build window. */
-enum {
+enum AirportToolbarWidgets {
ATW_AIRPORT,
ATW_DEMOLISH,
};
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index c4e7b5e51..9b3cb1ee9 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -34,12 +34,10 @@
#include "table/strings.h"
/** Company GUI constants. */
-enum {
- FIRST_GUI_CALL = INT_MAX, ///< default value to specify this is the first call of the resizable gui
+static const int FIRST_GUI_CALL = INT_MAX; ///< default value to specify this is the first call of the resizable gui
- EXP_LINESPACE = 2, ///< Amount of vertical space for a horizontal (sub-)total line.
- EXP_BLOCKSPACE = 10, ///< Amount of vertical space between two blocks of numbers.
-};
+static const uint EXP_LINESPACE = 2; ///< Amount of vertical space for a horizontal (sub-)total line.
+static const uint EXP_BLOCKSPACE = 10; ///< Amount of vertical space between two blocks of numbers.
static void DoSelectCompanyManagerFace(Window *parent);
diff --git a/src/console_gui.cpp b/src/console_gui.cpp
index ac0e6103c..0c187407e 100644
--- a/src/console_gui.cpp
+++ b/src/console_gui.cpp
@@ -21,13 +21,10 @@
#include "console_func.h"
#include "rev.h"
-
-enum {
- ICON_HISTORY_SIZE = 20,
- ICON_LINE_SPACING = 2,
- ICON_RIGHT_BORDERWIDTH = 10,
- ICON_BOTTOM_BORDERWIDTH = 12,
-};
+static const uint ICON_HISTORY_SIZE = 20;
+static const uint ICON_LINE_SPACING = 2;
+static const uint ICON_RIGHT_BORDERWIDTH = 10;
+static const uint ICON_BOTTOM_BORDERWIDTH = 12;
/**
* Container for a single line of console output
@@ -446,7 +443,7 @@ static void IConsoleHistoryNavigate(int direction)
/* watch out for overflows, just wrap around */
if (i < 0) i = ICON_HISTORY_SIZE - 1;
- if (i >= ICON_HISTORY_SIZE) i = 0;
+ if ((uint)i >= ICON_HISTORY_SIZE) i = 0;
if (direction > 0) {
if (_iconsole_history[i] == NULL) i = 0;
diff --git a/src/currency.cpp b/src/currency.cpp
index 05ff9b884..535179f88 100644
--- a/src/currency.cpp
+++ b/src/currency.cpp
@@ -62,7 +62,7 @@ CurrencySpec _currency_specs[NUM_CURRENCY];
* Every currency used by Ottd is there, just in case TTDPatch will
* add those missing in its code
**/
-enum {
+enum Currencies {
CURR_GBP,
CURR_USD,
CURR_EUR,
diff --git a/src/date.cpp b/src/date.cpp
index 944e40bc4..fbb8c42bb 100644
--- a/src/date.cpp
+++ b/src/date.cpp
@@ -55,7 +55,7 @@ static const uint16 _month_date_from_year_day[] = {
};
#undef M
-enum {
+enum DaysTillMonth {
ACCUM_JAN = 0,
ACCUM_FEB = ACCUM_JAN + 31,
ACCUM_MAR = ACCUM_FEB + 29,
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 133f3e3da..7c358145b 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -39,10 +39,8 @@ static int _ascender[FS_END];
FreeTypeSettings _freetype;
-enum {
- FACE_COLOUR = 1,
- SHADOW_COLOUR = 2,
-};
+static const byte FACE_COLOUR = 1;
+static const byte SHADOW_COLOUR = 2;
/** Get the font loaded into a Freetype face by using a font-name.
* If no appropiate font is found, the function returns an error */
diff --git a/src/gamelog.cpp b/src/gamelog.cpp
index c0325fd2a..62781fddd 100644
--- a/src/gamelog.cpp
+++ b/src/gamelog.cpp
@@ -85,11 +85,9 @@ void GamelogReset()
_current_action = NULL;
}
-enum {
- GAMELOG_BUF_LEN = 1024 ///< length of buffer for one line of text
-};
+static const uint GAMELOG_BUF_LEN = 1024; ///< length of buffer for one line of text
-static int _dbgofs = 0; ///< offset in current output buffer
+static uint _dbgofs = 0; ///< offset in current output buffer
static void AddDebugText(char *buf, const char *s, ...) WARN_FORMAT(2, 3);
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 127a248da..6cfe68a7b 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -74,10 +74,9 @@ static Rect _invalid_rect;
static const byte *_colour_remap_ptr;
static byte _string_colourremap[3]; ///< Recoloursprite for stringdrawing. The grf loader ensures, that ST_FONT sprites only use colours 0 to 2.
-enum {
- DIRTY_BLOCK_HEIGHT = 8,
- DIRTY_BLOCK_WIDTH = 64,
-};
+static const uint DIRTY_BLOCK_HEIGHT = 8;
+static const uint DIRTY_BLOCK_WIDTH = 64;
+
static uint _dirty_bytes_per_line = 0;
static byte *_dirty_blocks = NULL;
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 453421c05..b24774253 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -2187,10 +2187,8 @@ static void ReportNewsProductionChangeIndustry(Industry *ind, CargoID type, int
);
}
-enum {
- PERCENT_TRANSPORTED_60 = 153,
- PERCENT_TRANSPORTED_80 = 204,
-};
+static const uint PERCENT_TRANSPORTED_60 = 153;
+static const uint PERCENT_TRANSPORTED_80 = 204;
/** Change industry production or do closure
* @param i Industry for which changes are performed
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index fe108c553..4dc79cbba 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -79,14 +79,14 @@ static const WindowDesc _land_info_desc(
);
class LandInfoWindow : public Window {
- enum {
+ enum LandInfoLines {
LAND_INFO_CENTERED_LINES = 12, ///< Up to 12 centered lines
LAND_INFO_MULTICENTER_LINE = LAND_INFO_CENTERED_LINES, ///< One multicenter line
LAND_INFO_LINE_END,
-
- LAND_INFO_LINE_BUFF_SIZE = 512,
};
+ static const uint LAND_INFO_LINE_BUFF_SIZE = 512;
+
public:
char landinfo_data[LAND_INFO_LINE_END][LAND_INFO_LINE_BUFF_SIZE];
TileIndex tile;
diff --git a/src/music/qtmidi.cpp b/src/music/qtmidi.cpp
index e3e32e470..844fd190a 100644
--- a/src/music/qtmidi.cpp
+++ b/src/music/qtmidi.cpp
@@ -41,9 +41,7 @@
static FMusicDriver_QtMidi iFMusicDriver_QtMidi;
-enum {
- midiType = 'Midi' ///< OSType code for MIDI songs.
-};
+static const uint MIDI_TYPE = 'Midi' ///< OSType code for MIDI songs.
/**
@@ -61,9 +59,9 @@ static void SetMIDITypeIfNeeded(const FSRef *ref)
if (noErr != FSGetCatalogInfo(ref, kFSCatInfoNodeFlags | kFSCatInfoFinderInfo, &catalogInfo, NULL, NULL, NULL)) return;
if (!(catalogInfo.nodeFlags & kFSNodeIsDirectoryMask)) {
FileInfo * const info = (FileInfo *) catalogInfo.finderInfo;
- if (info->fileType != midiType && !(info->finderFlags & kIsAlias)) {
+ if (info->fileType != MIDI_TYPE && !(info->finderFlags & kIsAlias)) {
OSErr e;
- info->fileType = midiType;
+ info->fileType = MIDI_TYPE;
e = FSSetCatalogInfo(ref, kFSCatInfoFinderInfo, &catalogInfo);
if (e == noErr) {
DEBUG(driver, 3, "qtmidi: changed filetype to 'Midi'");
@@ -161,7 +159,7 @@ static void InitQuickTimeIfNeeded()
/** Possible states of the QuickTime music driver. */
-enum {
+enum QTStates {
QT_STATE_IDLE, ///< No file loaded.
QT_STATE_PLAY, ///< File loaded, playing.
QT_STATE_STOP, ///< File loaded, stopped.
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 10ed4e20c..a3c9208cb 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -35,9 +35,7 @@
* some spaces and possible translations of [All] to other languages. */
assert_compile((int)DRAW_STRING_BUFFER >= (int)NETWORK_CHAT_LENGTH + NETWORK_NAME_LENGTH + 40);
-enum {
- NETWORK_CHAT_LINE_SPACING = 3,
-};
+static const uint NETWORK_CHAT_LINE_SPACING = 3;
struct ChatMessage {
char message[DRAW_STRING_BUFFER];
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 8f377a0ba..b2b15133c 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -225,10 +225,8 @@ enum NetworkContentListWindowWidgets {
class NetworkContentListWindow : public QueryStringBaseWindow, ContentCallback {
typedef GUIList<const ContentInfo*> GUIContentList;
- enum {
- EDITBOX_MAX_SIZE = 50,
- EDITBOX_MAX_LENGTH = 300,
- };
+ static const uint EDITBOX_MAX_SIZE = 50;
+ static const uint EDITBOX_MAX_LENGTH = 300;
/** Runtime saved values */
static Listing last_sorting;
diff --git a/src/network/network_gamelist.cpp b/src/network/network_gamelist.cpp
index 61efe3b79..0ef8b1b2e 100644
--- a/src/network/network_gamelist.cpp
+++ b/src/network/network_gamelist.cpp
@@ -132,11 +132,9 @@ void NetworkGameListRemoveItem(NetworkGameList *remove)
}
}
-enum {
- MAX_GAME_LIST_REQUERY_COUNT = 10, ///< How often do we requery in number of times per server?
- REQUERY_EVERY_X_GAMELOOPS = 60, ///< How often do we requery in time?
- REFRESH_GAMEINFO_X_REQUERIES = 50, ///< Refresh the game info itself after REFRESH_GAMEINFO_X_REQUERIES * REQUERY_EVERY_X_GAMELOOPS game loops
-};
+static const uint MAX_GAME_LIST_REQUERY_COUNT = 10; ///< How often do we requery in number of times per server?
+static const uint REQUERY_EVERY_X_GAMELOOPS = 60; ///< How often do we requery in time?
+static const uint REFRESH_GAMEINFO_X_REQUERIES = 50; ///< Refresh the game info itself after REFRESH_GAMEINFO_X_REQUERIES * REQUERY_EVERY_X_GAMELOOPS game loops
/** Requeries the (game) servers we have not gotten a reply from */
void NetworkGameListRequery()
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 14cab7647..eb4f8b99b 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -36,11 +36,9 @@ static ThreadMutex *_network_udp_mutex = ThreadMutex::New();
/** Session key to register ourselves to the master server */
static uint64 _session_key = 0;
-enum {
- ADVERTISE_NORMAL_INTERVAL = 30000, // interval between advertising in ticks (15 minutes)
- ADVERTISE_RETRY_INTERVAL = 300, // readvertise when no response after this many ticks (9 seconds)
- ADVERTISE_RETRY_TIMES = 3 // give up readvertising after this much failed retries
-};
+static const uint ADVERTISE_NORMAL_INTERVAL = 30000; ///< interval between advertising in ticks (15 minutes)
+static const uint ADVERTISE_RETRY_INTERVAL = 300; ///< readvertise when no response after this many ticks (9 seconds)
+static const uint ADVERTISE_RETRY_TIMES = 3; ///< give up readvertising after this much failed retries
NetworkUDPSocketHandler *_udp_client_socket = NULL; ///< udp client socket
NetworkUDPSocketHandler *_udp_server_socket = NULL; ///< udp server socket
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 5031ea89c..ac4fcce53 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -180,9 +180,7 @@ public:
typedef void (*SpecialSpriteHandler)(ByteReader *buf);
-enum {
- MAX_STATIONS = 256,
-};
+static const uint MAX_STATIONS = 256;
/* Temporary data used when loading only */
struct GRFTempEngineData {
@@ -6609,7 +6607,7 @@ static void FinaliseAirportsArray()
AirportTileSpec **&airporttilespec = (*file)->airtspec;
if (airporttilespec != NULL) {
- for (int i = 0; i < NUM_AIRPORTTILES; i++) {
+ for (uint i = 0; i < NUM_AIRPORTTILES; i++) {
if (airporttilespec[i] != NULL && airporttilespec[i]->enabled) {
_airporttile_mngr.SetEntitySpec(airporttilespec[i]);
}
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index fcb4c764c..e2ce07dea 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -154,7 +154,7 @@ static int MapOldSubType(const Vehicle *v)
/* TTDP style aircraft movement states for GRF Action 2 Var 0xE2 */
-enum {
+enum TTDPAircraftMovementStates {
AMS_TTDP_HANGAR,
AMS_TTDP_TO_HANGAR,
AMS_TTDP_TO_PAD1,
@@ -290,7 +290,7 @@ static byte MapAircraftMovementState(const Aircraft *v)
/* TTDP style aircraft movement action for GRF Action 2 Var 0xE6 */
-enum {
+enum TTDPAircraftMovementActions {
AMA_TTDP_IN_HANGAR,
AMA_TTDP_ON_PAD1,
AMA_TTDP_ON_PAD2,
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 095b6d5dc..80264f5fe 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -147,10 +147,8 @@ private:
const GRFConfig *sel;
int sel_pos;
- enum {
- EDITBOX_MAX_SIZE = 50,
- EDITBOX_MAX_LENGTH = 300,
- };
+ static const uint EDITBOX_MAX_SIZE = 50;
+ static const uint EDITBOX_MAX_LENGTH = 300;
/**
* (Re)build the grf as its amount has changed because
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 56e8a5d48..df1d0a567 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -35,9 +35,7 @@
static StationClass _station_classes[STAT_CLASS_MAX];
-enum {
- MAX_SPECLIST = 255,
-};
+static const uint MAX_SPECLIST = 255;
enum TriggerArea {
TA_TILE,
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp
index 51dbd4745..0edb2eea3 100644
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -51,7 +51,7 @@ enum OskWidgets {
char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1];
static WChar _keyboard[2][OSK_KEYBOARD_ENTRIES];
-enum {
+enum KeyStateBits {
KEYS_NONE,
KEYS_SHIFT,
KEYS_CAPS
diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp
index 1e656e547..62eb0f4e4 100644
--- a/src/pathfinder/npf/npf.cpp
+++ b/src/pathfinder/npf/npf.cpp
@@ -21,15 +21,13 @@
#include "../follow_track.hpp"
#include "aystar.h"
-enum {
- NPF_HASH_BITS = 12, ///< The size of the hash used in pathfinding. Just changing this value should be sufficient to change the hash size. Should be an even value.
- /* Do no change below values */
- NPF_HASH_SIZE = 1 << NPF_HASH_BITS,
- NPF_HASH_HALFBITS = NPF_HASH_BITS / 2,
- NPF_HASH_HALFMASK = (1 << NPF_HASH_HALFBITS) - 1
-};
+static const uint NPF_HASH_BITS = 12; ///< The size of the hash used in pathfinding. Just changing this value should be sufficient to change the hash size. Should be an even value.
+/* Do no change below values */
+static const uint NPF_HASH_SIZE = 1 << NPF_HASH_BITS;
+static const uint NPF_HASH_HALFBITS = NPF_HASH_BITS / 2;
+static const uint NPF_HASH_HALFMASK = (1 << NPF_HASH_HALFBITS) - 1;
-/* Meant to be stored in AyStar.targetdata */
+/** Meant to be stored in AyStar.targetdata */
struct NPFFindStationOrTileData {
TileIndex dest_coords; ///< An indication of where the station is, for heuristic purposes, or the target tile
StationID station_index; ///< station index we're heading for, or INVALID_STATION when we're heading for a tile
@@ -39,21 +37,21 @@ struct NPFFindStationOrTileData {
const Vehicle *v; ///< The vehicle we are pathfinding for
};
-/* Indices into AyStar.userdata[] */
-enum {
+/** Indices into AyStar.userdata[] */
+enum AyStarUserDataType {
NPF_TYPE = 0, ///< Contains a TransportTypes value
NPF_SUB_TYPE, ///< Contains the sub transport type
NPF_OWNER, ///< Contains an Owner value
NPF_RAILTYPES, ///< Contains a bitmask the compatible RailTypes of the engine when NPF_TYPE == TRANSPORT_RAIL. Unused otherwise.
};
-/* Indices into AyStarNode.userdata[] */
-enum {
+/** Indices into AyStarNode.userdata[] */
+enum AyStarNodeUserDataType {
NPF_TRACKDIR_CHOICE = 0, ///< The trackdir chosen to get here
NPF_NODE_FLAGS,
};
-/* Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFSetFlag() and NPFGetFlag() to use them. */
+/** Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFSetFlag() and NPFGetFlag() to use them. */
enum NPFNodeFlag {
NPF_FLAG_SEEN_SIGNAL, ///< Used to mark that a signal was seen on the way, for rail only
NPF_FLAG_2ND_SIGNAL, ///< Used to mark that two signals were seen, rail only
@@ -66,7 +64,7 @@ enum NPFNodeFlag {
NPF_FLAG_IGNORE_RESERVED, ///< Used to mark that reserved tiles should be considered impassable
};
-/* Meant to be stored in AyStar.userpath */
+/** Meant to be stored in AyStar.userpath */
struct NPFFoundTargetData {
uint best_bird_dist; ///< The best heuristic found. Is 0 if the target was found
uint best_path_dist; ///< The shortest path. Is UINT_MAX if no path is found
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index abba2058f..0c1ba476b 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -2129,7 +2129,7 @@ static void DrawTrackBits(TileInfo *ti, TrackBits track)
* The addtion of 2 per enum is necessary in order to "jump" over the
* green state sprite, all signal sprites being in pair,
* starting with the off-red state */
-enum {
+enum SignalOffsets {
SIGNAL_TO_SOUTHWEST = 0,
SIGNAL_TO_NORTHEAST = 2,
SIGNAL_TO_SOUTHEAST = 4,
diff --git a/src/signal.cpp b/src/signal.cpp
index cdcde264e..9daefff8d 100644
--- a/src/signal.cpp
+++ b/src/signal.cpp
@@ -20,12 +20,10 @@
/** these are the maximums used for updating signal blocks */
-enum {
- SIG_TBU_SIZE = 64, ///< number of signals entering to block
- SIG_TBD_SIZE = 256, ///< number of intersections - open nodes in current block
- SIG_GLOB_SIZE = 128, ///< number of open blocks (block can be opened more times until detected)
- SIG_GLOB_UPDATE = 64, ///< how many items need to be in _globset to force update
-};
+static const uint SIG_TBU_SIZE = 64; ///< number of signals entering to block
+static const uint SIG_TBD_SIZE = 256; ///< number of intersections - open nodes in current block
+static const uint SIG_GLOB_SIZE = 128; ///< number of open blocks (block can be opened more times until detected)
+static const uint SIG_GLOB_UPDATE = 64; ///< how many items need to be in _globset to force update
assert_compile(SIG_GLOB_UPDATE <= SIG_GLOB_SIZE);
diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp
index f8d853937..c83203212 100644
--- a/src/statusbar_gui.cpp
+++ b/src/statusbar_gui.cpp
@@ -83,12 +83,10 @@ struct StatusBarWindow : Window {
int ticker_scroll;
int reminder_timeout;
- enum {
- TICKER_STOP = 1640, ///< scrolling is finished when counter reaches this value
- REMINDER_START = 91, ///< initial value of the reminder counter (right dot on the right)
- REMINDER_STOP = 0, ///< reminder disappears when counter reaches this value
- COUNTER_STEP = 2, ///< this is subtracted from active counters every tick
- };
+ static const int TICKER_STOP = 1640; ///< scrolling is finished when counter reaches this value
+ static const int REMINDER_START = 91; ///< initial value of the reminder counter (right dot on the right)
+ static const int REMINDER_STOP = 0; ///< reminder disappears when counter reaches this value
+ static const int COUNTER_STEP = 2; ///< this is subtracted from active counters every tick
StatusBarWindow(const WindowDesc *desc) : Window()
{
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index a0d4427fa..b690f0ac9 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -211,11 +211,9 @@ static void PopupMainToolbMenu(Window *w, int widget, StringID string, int count
}
/** Enum for the Company Toolbar's network related buttons */
-enum {
- CTMN_CLIENT_LIST = -1, ///< Show the client list
- CTMN_NEW_COMPANY = -2, ///< Create a new company
- CTMN_SPECTATE = -3, ///< Become spectator
-};
+static const int CTMN_CLIENT_LIST = -1; ///< Show the client list
+static const int CTMN_NEW_COMPANY = -2; ///< Create a new company
+static const int CTMN_SPECTATE = -3; ///< Become spectator
/**
* Pop up a generic company list menu.
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index 16291af14..bbd6841dc 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -126,10 +126,8 @@ struct CargoSummaryItem {
}
};
-enum {
- TRAIN_DETAILS_MIN_INDENT = 32, ///< Minimum indent level in the train details window
- TRAIN_DETAILS_MAX_INDENT = 72, ///< Maximum indent level in the train details window; wider than this and we start on a new line
-};
+static const uint TRAIN_DETAILS_MIN_INDENT = 32; ///< Minimum indent level in the train details window
+static const uint TRAIN_DETAILS_MAX_INDENT = 72; ///< Maximum indent level in the train details window; wider than this and we start on a new line
/** Container for the cargo summary information. */
typedef SmallVector<CargoSummaryItem, 2> CargoSummary;
@@ -307,7 +305,7 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
GetCargoSummaryOfArticulatedVehicle(v, &_cargo_summary);
/* Draw sprites */
- int dx = 0;
+ uint dx = 0;
int px = x;
const Train *u = v;
do {
diff --git a/src/video/allegro_v.cpp b/src/video/allegro_v.cpp
index 9d9ef1f57..2739d0f31 100644
--- a/src/video/allegro_v.cpp
+++ b/src/video/allegro_v.cpp
@@ -318,10 +318,8 @@ static uint32 ConvertAllegroKeyIntoMy()
return (key << 16) + unicode;
}
-enum {
- LEFT_BUTTON,
- RIGHT_BUTTON,
-};
+static const uint LEFT_BUTTON = 0;
+static const uint RIGHT_BUTTON = 1;
static void PollEvent()
{
diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm
index 284be0657..5df3f5b75 100644
--- a/src/video/cocoa/event.mm
+++ b/src/video/cocoa/event.mm
@@ -49,7 +49,7 @@
/* Right Mouse Button Emulation enum */
-enum {
+enum RightMouseButtonEmulationState {
RMBE_COMMAND,
RMBE_CONTROL,
RMBE_OFF,