diff options
author | bjarni <bjarni@openttd.org> | 2008-04-27 20:09:29 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2008-04-27 20:09:29 +0000 |
commit | 783e20a263a5e72bfed81ef7a9535a2caefebf79 (patch) | |
tree | efbff2346a07d27ade486566153b76347444eb3f /src/player_base.h | |
parent | d6c971fd9b3777bcd0fa41ecaefb52ab2567bc89 (diff) | |
download | openttd-783e20a263a5e72bfed81ef7a9535a2caefebf79.tar.xz |
(svn r12913) -Add: ability to backup and restore a player's economic data and data for a vehicle (or chain of vehicles)
Autoreplace uses this with the following benefits:
-Mass autoreplace (the button in the depot window) will now estimate costs correctly
-Autoreplace now either replaces correctly or manages to keep the original vehicle (no more broken trains)
Thanks to Ammler for testing this
Diffstat (limited to 'src/player_base.h')
-rw-r--r-- | src/player_base.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/player_base.h b/src/player_base.h index 2bb3fd56c..cce41eb60 100644 --- a/src/player_base.h +++ b/src/player_base.h @@ -73,6 +73,18 @@ struct Player { uint16 num_engines[TOTAL_NUM_ENGINES]; ///< caches the number of engines of each type the player owns (no need to save this) }; +struct PlayerMoneyBackup { +private: + Money backup_yearly_expenses[EXPENSES_END]; + PlayerEconomyEntry backup_cur_economy; + Player *p; + +public: + PlayerMoneyBackup(Player *player); + + void Restore(); +}; + extern Player _players[MAX_PLAYERS]; #define FOR_ALL_PLAYERS(p) for (p = _players; p != endof(_players); p++) |