(svn r2848) -Fix: [ 1256044 ] fixed crash when loading a map made before rev 2817 in scenario editor. This was introduced in 2817
authorbjarni
Wed, 10 Aug 2005 21:16:38 +0000
changeset 2322 962f8825ff6b
parent 2321 455694cdbada
child 2323 13182c22f164
(svn r2848) -Fix: [ 1256044 ] fixed crash when loading a map made before rev 2817 in scenario editor. This was introduced in 2817
openttd.c
--- a/openttd.c	Tue Aug 09 12:58:22 2005 +0000
+++ b/openttd.c	Wed Aug 10 21:16:38 2005 +0000
@@ -1249,11 +1249,14 @@
 			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) {