(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
This commit is contained in:
@@ -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++)
|
||||
|
||||
|
Reference in New Issue
Block a user