summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-07-25 10:00:03 +0000
committerrubidium <rubidium@openttd.org>2008-07-25 10:00:03 +0000
commit1a4ac3ee5c23702db407f18186212c4df9c52af2 (patch)
tree42a4dc90aefb22555ca296a12fee4be68be10ed1 /src
parent00d87b537f6a99f67c41f0d0746dbc2ea73c13f5 (diff)
downloadopenttd-1a4ac3ee5c23702db407f18186212c4df9c52af2.tar.xz
(svn r13821) -Codechange: replace some uint8/bytes with more specificly named typedefs and replace a few magic numbers.
Diffstat (limited to 'src')
-rw-r--r--src/engine.cpp6
-rw-r--r--src/engine_base.h4
-rw-r--r--src/player_type.h2
-rw-r--r--src/town.h2
4 files changed, 8 insertions, 6 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 6712860f3..ab8aed61d 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -342,11 +342,11 @@ void EnginesDailyLoop()
DeleteWindowById(WC_ENGINE_PREVIEW, i);
e->preview_player_rank++;
}
- } else if (e->preview_player_rank != 0xFF) {
+ } else if (e->preview_player_rank != PLAYER_SPECTATOR) {
PlayerID best_player = GetBestPlayer(e->preview_player_rank);
if (best_player == PLAYER_SPECTATOR) {
- e->preview_player_rank = 0xFF;
+ e->preview_player_rank = PLAYER_SPECTATOR;
continue;
}
@@ -419,7 +419,7 @@ static void NewVehicleAvailable(Engine *e)
AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
/* Now available for all players */
- e->player_avail = (byte)-1;
+ e->player_avail = (PlayerMask)-1;
/* Do not introduce new rail wagons */
if (IsWagon(index)) return;
diff --git a/src/engine_base.h b/src/engine_base.h
index cff59fcb2..6c018b674 100644
--- a/src/engine_base.h
+++ b/src/engine_base.h
@@ -20,9 +20,9 @@ struct Engine : PoolItem<Engine, EngineID, &_Engine_pool> {
uint16 duration_phase_1, duration_phase_2, duration_phase_3;
byte lifelength;
byte flags;
- uint8 preview_player_rank;
+ PlayerByte preview_player_rank;
byte preview_wait;
- byte player_avail;
+ PlayerMask player_avail;
uint8 image_index; ///< Original vehicle image index
VehicleType type; ///< type, ie VEH_ROAD, VEH_TRAIN, etc.
diff --git a/src/player_type.h b/src/player_type.h
index 79d92f691..0dbd4e687 100644
--- a/src/player_type.h
+++ b/src/player_type.h
@@ -42,6 +42,8 @@ typedef TinyEnumT<Owner> OwnerByte;
typedef Owner PlayerID;
typedef OwnerByte PlayerByte;
+typedef uint8 PlayerMask;
+
struct Player;
typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h
diff --git a/src/town.h b/src/town.h
index dfdb7fbaa..65cfe6cbb 100644
--- a/src/town.h
+++ b/src/town.h
@@ -124,7 +124,7 @@ struct Town : PoolItem<Town, TownID, &_Town_pool> {
byte statues;
/* Player ratings as well as a mask that determines which players have a rating. */
- byte have_ratings;
+ PlayerMask have_ratings;
uint8 unwanted[MAX_PLAYERS]; ///< how many months companies aren't wanted by towns (bribe)
PlayerByte exclusivity; ///< which player has exslusivity
uint8 exclusive_counter; ///< months till the exclusivity expires