summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-12-28 04:20:56 +0000
committerbelugas <belugas@openttd.org>2007-12-28 04:20:56 +0000
commite9a039b845afb5296a37d8413c8c651b1eb699fb (patch)
tree3e955cb6c9b2d6c09572877bb7dfe3a00eb7a9cc /src/openttd.cpp
parent5087a6cdd76276118bcba6bd4c14425da76eef7d (diff)
downloadopenttd-e9a039b845afb5296a37d8413c8c651b1eb699fb.tar.xz
(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.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index fad4bf800..1bdb75a6b 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -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;