(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
This commit is contained in:
45
src/player.h
45
src/player.h
@@ -15,6 +15,7 @@
|
||||
#include "engine.h"
|
||||
#include "livery.h"
|
||||
#include "genworld.h"
|
||||
#include "autoreplace_type.h"
|
||||
|
||||
struct PlayerEconomyEntry {
|
||||
Money income;
|
||||
@@ -330,50 +331,6 @@ void LoadFromHighScore();
|
||||
int8 SaveHighScoreValue(const Player *p);
|
||||
int8 SaveHighScoreValueNetwork();
|
||||
|
||||
/* Engine Replacement Functions */
|
||||
|
||||
/**
|
||||
* Remove all engine replacement settings for the given player.
|
||||
* @param p Player.
|
||||
*/
|
||||
static inline void RemoveAllEngineReplacementForPlayer(Player *p) { RemoveAllEngineReplacement(&p->engine_renew_list); }
|
||||
|
||||
/**
|
||||
* Retrieve the engine replacement for the given player and original engine type.
|
||||
* @param p Player.
|
||||
* @param engine Engine type.
|
||||
* @return The engine type to replace with, or INVALID_ENGINE if no
|
||||
* replacement is in the list.
|
||||
*/
|
||||
static inline EngineID EngineReplacementForPlayer(const Player *p, EngineID engine, GroupID group) { return EngineReplacement(p->engine_renew_list, engine, group); }
|
||||
|
||||
/**
|
||||
* Check if a player has a replacement set up for the given engine.
|
||||
* @param p Player.
|
||||
* @param engine Engine type to be replaced.
|
||||
* @return true if a replacement was set up, false otherwise.
|
||||
*/
|
||||
static inline bool EngineHasReplacementForPlayer(const Player *p, EngineID engine, GroupID group) { return EngineReplacementForPlayer(p, engine, group) != INVALID_ENGINE; }
|
||||
|
||||
/**
|
||||
* Add an engine replacement for the player.
|
||||
* @param p Player.
|
||||
* @param old_engine The original engine type.
|
||||
* @param new_engine The replacement engine type.
|
||||
* @param flags The calling command flags.
|
||||
* @return 0 on success, CMD_ERROR on failure.
|
||||
*/
|
||||
static inline CommandCost AddEngineReplacementForPlayer(Player *p, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags) { return AddEngineReplacement(&p->engine_renew_list, old_engine, new_engine, group, flags); }
|
||||
|
||||
/**
|
||||
* Remove an engine replacement for the player.
|
||||
* @param p Player.
|
||||
* @param engine The original engine type.
|
||||
* @param flags The calling command flags.
|
||||
* @return 0 on success, CMD_ERROR on failure.
|
||||
*/
|
||||
static inline CommandCost RemoveEngineReplacementForPlayer(Player *p, EngineID engine, GroupID group, uint32 flags) {return RemoveEngineReplacement(&p->engine_renew_list, engine, group, flags); }
|
||||
|
||||
/**
|
||||
* Reset the livery schemes to the player's primary colour.
|
||||
* This is used on loading games without livery information and on new player start up.
|
||||
|
||||
Reference in New Issue
Block a user