Changeset - r2092:297c1ed07fe8
[Not reviewed]
master
0 3 0
truelight - 19 years ago 2005-07-17 13:34:19
truelight@openttd.org
(svn r2602) -Codechange: removed unused variable (disable_computer)
-Fix: Changed some stuff to make server-side AIs possible in the far future
3 files changed with 5 insertions and 6 deletions:
0 comments (0 inline, 0 general)
main_gui.c
Show inline comments
 
@@ -32,14 +32,12 @@
 
static const uint MinDate = 0;     // 1920-01-01 (MAX_YEAR_BEGIN_REAL)
 
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;
 

	
 
static byte _terraform_size = 1;
 
static byte _last_built_railtype;
 
extern void GenerateWorld(int mode, uint size_x, uint size_y);
openttd.c
Show inline comments
 
@@ -59,13 +59,12 @@ extern void ShowOSErrorBox(const char *b
 
bool LoadSavegame(const char *filename);
 

	
 
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
 
 * caused by the user, i.e. missing files or fatal configuration errors.
 
 * Post-0.4.0 since Celestar doesn't want this in SVN before. --pasky */
 

	
 
@@ -1029,13 +1028,13 @@ void StateGameLoop(void)
 
		RunTileLoop();
 
		CallVehicleTicks();
 
		CallLandscapeTick();
 

	
 
		// To bad the AI does not work in multiplayer, because states are not saved
 
		//  perfectly
 
		if (!disable_computer && !_networking)
 
		if (!_networking)
 
			RunOtherPlayersLoop();
 

	
 
		CallWindowTickEvent();
 
		NewsLoop();
 
		_current_player = p;
 
	}
players.c
Show inline comments
 
@@ -518,17 +518,19 @@ static void MaybeStartNewPlayer(void)
 
	n = 0;
 
	for(p=_players; p!=endof(_players); p++)
 
		if (p->is_active && p->is_ai)
 
			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)
 
{
 
	int i;
 
	memset(_players, 0, sizeof(_players));
0 comments (0 inline, 0 general)