summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main_gui.c7
-rw-r--r--player.h12
-rw-r--r--players.c12
3 files changed, 12 insertions, 19 deletions
diff --git a/main_gui.c b/main_gui.c
index 3254ffeb5..9726239c3 100644
--- a/main_gui.c
+++ b/main_gui.c
@@ -531,12 +531,7 @@ static int GetPlayerIndexFromMenu(int index)
static void UpdatePlayerMenuHeight(Window *w)
{
- uint num = 0;
- const Player *p;
-
- FOR_ALL_PLAYERS(p) {
- if (p->is_active) num++;
- }
+ byte num = ActivePlayerCount();
// Increase one to fit in PlayerList in the menu when in network
if (_networking && WP(w,menu_d).main_button == 9) num++;
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)
{
diff --git a/players.c b/players.c
index b4a279ab6..93f559d5a 100644
--- a/players.c
+++ b/players.c
@@ -192,18 +192,6 @@ void DrawPlayerFace(uint32 face, int color, int x, int y)
}
}
-byte ActivePlayerCount(void)
-{
- const Player *p;
- byte count = 0;
-
- FOR_ALL_PLAYERS(p) {
- if (p->is_active) count++;
- }
-
- return count;
-}
-
void InvalidatePlayerWindows(const Player *p)
{
PlayerID pid = p->index;