summaryrefslogtreecommitdiff
path: root/player.h
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2006-10-12 11:42:57 +0000
committerDarkvater <Darkvater@openttd.org>2006-10-12 11:42:57 +0000
commit40365cc2924a2a0bcff6732a44432845b6fe6cf1 (patch)
tree36f9f8314abfadad8df25176c1475acfe3b83c12 /player.h
parentafdc0c2e575e46161bed3267d8112dc9c98a66c7 (diff)
downloadopenttd-40365cc2924a2a0bcff6732a44432845b6fe6cf1.tar.xz
(svn r6748) -Codechange: Use already existing function to count active players.
Diffstat (limited to 'player.h')
-rw-r--r--player.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/player.h b/player.h
index 55aec0ce9..384afe4c4 100644
--- a/player.h
+++ b/player.h
@@ -216,7 +216,17 @@ VARDEF Player _players[MAX_PLAYERS];
// NOSAVE: can be determined from player structs
VARDEF byte _player_colors[MAX_PLAYERS];
-byte ActivePlayerCount(void);
+static inline byte ActivePlayerCount(void)
+{
+ const Player *p;
+ byte count = 0;
+
+ FOR_ALL_PLAYERS(p) {
+ if (p->is_active) count++;
+ }
+
+ return count;
+}
static inline Player* GetPlayer(PlayerID i)
{