# HG changeset patch # User Darkvater # Date 1160653377 0 # Node ID ddbd525a04d06a85658fccacd1742c58b9e24452 # Parent d9926c33e35a719e3ebba7da6f8c4fc9a6e10bc4 (svn r6748) -Codechange: Use already existing function to count active players. diff -r d9926c33e35a -r ddbd525a04d0 main_gui.c --- a/main_gui.c Thu Oct 12 11:30:16 2006 +0000 +++ b/main_gui.c Thu Oct 12 11:42:57 2006 +0000 @@ -531,12 +531,7 @@ 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 -r d9926c33e35a -r ddbd525a04d0 player.h --- a/player.h Thu Oct 12 11:30:16 2006 +0000 +++ b/player.h Thu Oct 12 11:42:57 2006 +0000 @@ -216,7 +216,17 @@ // 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 -r d9926c33e35a -r ddbd525a04d0 players.c --- a/players.c Thu Oct 12 11:30:16 2006 +0000 +++ b/players.c Thu Oct 12 11:42:57 2006 +0000 @@ -192,18 +192,6 @@ } } -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;