File diff r4844:dcf812ad20ab → r4845:2200ed004c20
player.h
Show inline comments
 
@@ -239,44 +239,51 @@ static inline bool IsLocalPlayer(void)
 
	return _local_player == _current_player;
 
}
 

	
 
void DeletePlayerWindows(PlayerID pi);
 
byte GetPlayerRailtypes(PlayerID p);
 

	
 
/** Finds out if a Player has a certain railtype available */
 
static inline bool HasRailtypeAvail(const Player *p, RailType Railtype)
 
{
 
	return HASBIT(p->avail_railtypes, Railtype);
 
}
 

	
 
static inline bool IsHumanPlayer(PlayerID pi)
 
{
 
	return !GetPlayer(pi)->is_ai;
 
}
 

	
 
static inline bool IsInteractivePlayer(PlayerID pi)
 
{
 
	return pi == _local_player;
 
}
 

	
 
/* Validate functions for rail building */
 
static inline bool ValParamRailtype(uint32 rail) { return HASBIT(GetPlayer(_current_player)->avail_railtypes, rail);}
 

	
 
/** Returns the "best" railtype a player can build.
 
 * As the AI doesn't know what the BEST one is, we have our own priority list
 
 * here. When adding new railtypes, modify this function
 
 * @param p the player "in action"
 
 * @return The "best" railtype a player has available
 
 */
 
static inline RailType GetBestRailtype(const Player* p)
 
{
 
	if (HasRailtypeAvail(p, RAILTYPE_MAGLEV)) return RAILTYPE_MAGLEV;
 
	if (HasRailtypeAvail(p, RAILTYPE_MONO)) return RAILTYPE_MONO;
 
	if (HasRailtypeAvail(p, RAILTYPE_ELECTRIC)) return RAILTYPE_ELECTRIC;
 
	return RAILTYPE_RAIL;
 
}
 

	
 
#define IS_HUMAN_PLAYER(p) (!GetPlayer(p)->is_ai)
 
#define IS_INTERACTIVE_PLAYER(p) ((p) == _local_player)
 

	
 
typedef struct HighScore {
 
	char company[100];
 
	StringID title; // NO_SAVE, has troubles with changing string-numbers.
 
	uint16 score;   // do NOT change type, will break hs.dat
 
} HighScore;
 

	
 
VARDEF HighScore _highscore_table[5][5]; // 4 difficulty-settings (+ network); top 5
 
void SaveToHighScore(void);
 
void LoadFromHighScore(void);
 
int8 SaveHighScoreValue(const Player *p);
 
int8 SaveHighScoreValueNetwork(void);