diff options
author | tron <tron@openttd.org> | 2005-05-06 06:56:30 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-05-06 06:56:30 +0000 |
commit | d17476b058fb877484159bec0b725d1be5a6d68f (patch) | |
tree | ec6a2e5ec15ed8e58408a2c562f10913bb6382e8 /player.h | |
parent | 203a84dd0b4f1fd7397052d3a645731eaeb5ebd7 (diff) | |
download | openttd-d17476b058fb877484159bec0b725d1be5a6d68f.tar.xz |
(svn r2271) CMD_SET_PLAYER_FACE, CMD_SET_PLAYER_COLOR, CMD_INCREASE_LOAN, CMD_DECREASE_LOAN only make sense for the current player, so don't explicitly pass a player number
Diffstat (limited to 'player.h')
-rw-r--r-- | player.h | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -192,12 +192,18 @@ int64 CalculateCompanyValue(Player *p); void InvalidatePlayerWindows(Player *p); void AiDoGameLoop(Player *p); void UpdatePlayerMoney32(Player *p); -#define DEREF_PLAYER(i) (&_players[i]) #define FOR_ALL_PLAYERS(p) for(p=_players; p != endof(_players); p++) #define MAX_PLAYERS 8 VARDEF Player _players[MAX_PLAYERS]; +#define DEREF_PLAYER(i) (GetPlayer(i)) +static inline Player* GetPlayer(uint i) +{ + assert(i < lengthof(_players)); + return &_players[i]; +} + #define IS_HUMAN_PLAYER(p) (!DEREF_PLAYER((byte)(p))->is_ai) #define IS_INTERACTIVE_PLAYER(p) (((byte)p) == _local_player) |