(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.

This will not (yet) be true if you are loading a scenario with the "-g" command line option.
This commit is contained in:
belugas
2007-12-28 04:20:56 +00:00
parent db45093f7b
commit 1b76c8bb67
4 changed files with 33 additions and 1 deletions

View File

@@ -1289,7 +1289,15 @@ static bool InitializeWindowsAndCaches()
Player *players[MAX_PLAYERS];
const Vehicle *v;
for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) players[i] = GetPlayer(i);
for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) {
players[i] = GetPlayer(i);
/* For each player, verify (while loading a scenario) that the inauguration date is the current year and set it
* accordingly if it is not the case. No need to set it on players that are not been used already,
* thus the MIN_YEAR (which is really nothing more than Zero, initialized value) test */
if (_file_to_saveload.filetype == FT_SCENARIO && players[i]->inaugurated_year != MIN_YEAR)
players[i]->inaugurated_year = _cur_year;
}
FOR_ALL_VEHICLES(v) {
if (!IsEngineCountable(v)) continue;