summaryrefslogtreecommitdiff
path: root/player.h
diff options
context:
space:
mode:
Diffstat (limited to 'player.h')
-rw-r--r--player.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/player.h b/player.h
index 6517d0d2d..7b59913f0 100644
--- a/player.h
+++ b/player.h
@@ -201,7 +201,8 @@ void AiDoGameLoop(Player *p);
void UpdatePlayerMoney32(Player *p);
#define FOR_ALL_PLAYERS(p) for(p=_players; p != endof(_players); p++)
-extern PlayerID _current_player;
+VARDEF PlayerID _local_player;
+VARDEF PlayerID _current_player;
#define MAX_PLAYERS 8
VARDEF Player _players[MAX_PLAYERS];
@@ -210,8 +211,13 @@ VARDEF byte _player_colors[MAX_PLAYERS];
static inline Player* GetPlayer(uint i)
{
- assert(i < lengthof(_players));
- return &_players[i];
+ assert(i < lengthof(_players));
+ return &_players[i];
+}
+
+static inline bool IsLocalPlayer(void)
+{
+ return _local_player == _current_player;
}
/** Returns the number of rail types the player can build