summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-07-17 13:34:19 +0000
committertruelight <truelight@openttd.org>2005-07-17 13:34:19 +0000
commit658f9cb03f9a5ec8a0dd772f6cadf54bf53a627a (patch)
treeb972b387c285fa94e42d87ae90990f1a2b2c769e
parent3ce9fb6bbd0169ace02f6510b151171d914d4414 (diff)
downloadopenttd-658f9cb03f9a5ec8a0dd772f6cadf54bf53a627a.tar.xz
(svn r2602) -Codechange: removed unused variable (disable_computer)
-Fix: Changed some stuff to make server-side AIs possible in the far future
-rw-r--r--main_gui.c2
-rw-r--r--openttd.c3
-rw-r--r--players.c6
3 files changed, 5 insertions, 6 deletions
diff --git a/main_gui.c b/main_gui.c
index 337f2a128..7450c307d 100644
--- a/main_gui.c
+++ b/main_gui.c
@@ -35,8 +35,6 @@ static const uint MaxDate = 29220; // 2000-01-01
extern void DoTestSave(void);
extern void DoTestLoad(void);
-extern bool disable_computer;
-
static int _rename_id;
static int _rename_what;
diff --git a/openttd.c b/openttd.c
index d80f90984..ffdced635 100644
--- a/openttd.c
+++ b/openttd.c
@@ -62,7 +62,6 @@ extern void HalGameLoop(void);
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 @@ void StateGameLoop(void)
// To bad the AI does not work in multiplayer, because states are not saved
// perfectly
- if (!disable_computer && !_networking)
+ if (!_networking)
RunOtherPlayersLoop();
CallWindowTickEvent();
diff --git a/players.c b/players.c
index 8892d39f8..4960a9327 100644
--- a/players.c
+++ b/players.c
@@ -521,11 +521,13 @@ static void MaybeStartNewPlayer(void)
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)