summaryrefslogtreecommitdiff
path: root/player.h
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2005-09-14 18:03:38 +0000
committerDarkvater <Darkvater@openttd.org>2005-09-14 18:03:38 +0000
commitc0c75ef16e57e6f2bbc8f3b7eeca2ec6b26ba053 (patch)
tree1c4620d5f83933db927ef94bd8a085442eaca0c1 /player.h
parent7cb1b719cf4e0e42c4afa103db68740f376df45c (diff)
downloadopenttd-c0c75ef16e57e6f2bbc8f3b7eeca2ec6b26ba053.tar.xz
(svn r2951) - Fix: [ 1259345 ] Changing engine in netgame opens train window for everyone
- Add IsLocalPlayer() which substitutes _local_player == _current_player
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