1
0
Fork 0

(svn r13821) -Codechange: replace some uint8/bytes with more specificly named typedefs and replace a few magic numbers.

release/0.7
rubidium 2008-07-25 10:00:03 +00:00
parent 00d87b537f
commit 1a4ac3ee5c
4 changed files with 8 additions and 6 deletions

View File

@ -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;

View File

@ -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.

View File

@ -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

View File

@ -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