summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-08-10 21:16:38 +0000
committerbjarni <bjarni@openttd.org>2005-08-10 21:16:38 +0000
commit042f079b8dcfb74e8738e4601f11a56d1a468cd9 (patch)
treeac88ce09a6ba316f8bb6fc7dd2e8b4a71f1ab029
parent8f398f2f503a6913f2b4ce9706c65939728bcc32 (diff)
downloadopenttd-042f079b8dcfb74e8738e4601f11a56d1a468cd9.tar.xz
(svn r2848) -Fix: [ 1256044 ] fixed crash when loading a map made before rev 2817 in scenario editor. This was introduced in 2817
-rw-r--r--openttd.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/openttd.c b/openttd.c
index 01691763a..a7d1ed181 100644
--- a/openttd.c
+++ b/openttd.c
@@ -1249,11 +1249,14 @@ bool AfterLoadGame(uint version)
p->engine_renew_months = -6;
p->engine_renew_money = 100000;
}
- // Set the human controlled player to the patch settings
- p = GetPlayer(_local_player);
- p->engine_renew = _patches.autorenew;
- p->engine_renew_months = _patches.autorenew_months;
- p->engine_renew_money = _patches.autorenew_money;
+ if (_local_player < MAX_PLAYERS) {
+ // Set the human controlled player to the patch settings
+ // Scenario editor do not have any companies
+ p = GetPlayer(_local_player);
+ p->engine_renew = _patches.autorenew;
+ p->engine_renew_months = _patches.autorenew_months;
+ p->engine_renew_money = _patches.autorenew_money;
+ }
}
FOR_ALL_PLAYERS(p) {