(svn r2602) -Codechange: removed unused variable (disable_computer)
authortruelight
Sun, 17 Jul 2005 13:34:19 +0000
changeset 2092 c30495feef79
parent 2091 97197b795fe6
child 2093 357b05db938f
(svn r2602) -Codechange: removed unused variable (disable_computer)
-Fix: Changed some stuff to make server-side AIs possible in the far future
main_gui.c
openttd.c
players.c
--- a/main_gui.c	Sun Jul 17 12:49:00 2005 +0000
+++ b/main_gui.c	Sun Jul 17 13:34:19 2005 +0000
@@ -35,8 +35,6 @@
 extern void DoTestSave(void);
 extern void DoTestLoad(void);
 
-extern bool disable_computer;
-
 static int _rename_id;
 static int _rename_what;
 
--- a/openttd.c	Sun Jul 17 12:49:00 2005 +0000
+++ b/openttd.c	Sun Jul 17 13:34:19 2005 +0000
@@ -62,7 +62,6 @@
 
 uint32 _pixels_redrawn;
 bool _dbg_screen_rect;
-bool disable_computer; // We should get ride of this thing.. is only used for a debug-cheat
 static byte _os_version = 0;
 
 /* TODO: usrerror() for errors which are not of an internal nature but
@@ -1032,7 +1031,7 @@
 
 		// To bad the AI does not work in multiplayer, because states are not saved
 		//  perfectly
-		if (!disable_computer && !_networking)
+		if (!_networking)
 			RunOtherPlayersLoop();
 
 		CallWindowTickEvent();
--- a/players.c	Sun Jul 17 12:49:00 2005 +0000
+++ b/players.c	Sun Jul 17 13:34:19 2005 +0000
@@ -521,11 +521,13 @@
 			n++;
 
 	// when there's a lot of computers in game, the probability that a new one starts is lower
-	if (n < (uint)_opt.diff.max_no_competitors && n < RandomRange(_opt.diff.max_no_competitors + 2))
+	if (n < (uint)_opt.diff.max_no_competitors)
+		if (n < (!_network_server) ? RandomRange(_opt.diff.max_no_competitors + 2) : InteractiveRandomRange(_opt.diff.max_no_competitors + 2))
 		DoStartupNewPlayer(true);
 
 	// The next AI starts like the difficulty setting said, with +2 month max
-	_next_competitor_start = _opt.diff.competitor_start_time * 90 * DAY_TICKS + RandomRange(60 * DAY_TICKS) + 1;
+	_next_competitor_start = _opt.diff.competitor_start_time * 90 * DAY_TICKS + 1;
+	_next_competitor_start += (!_network_server) ? RandomRange(60 * DAY_TICKS) : InteractiveRandomRange(60 * DAY_TICKS);
 }
 
 void InitializePlayers(void)