Changeset - r4824:f75e6f5f61e7
[Not reviewed]
master
0 3 0
Darkvater - 18 years ago 2006-10-12 11:42:57
darkvater@openttd.org
(svn r6748) -Codechange: Use already existing function to count active players.
3 files changed with 12 insertions and 19 deletions:
0 comments (0 inline, 0 general)
main_gui.c
Show inline comments
 
@@ -531,12 +531,7 @@ static int GetPlayerIndexFromMenu(int in
 

	
 
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++;
player.h
Show inline comments
 
@@ -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)
 
{
players.c
Show inline comments
 
@@ -192,18 +192,6 @@ void DrawPlayerFace(uint32 face, int col
 
	}
 
}
 

	
 
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;
0 comments (0 inline, 0 general)