From b2110cbaedbbbbb18769e4594f416dfef1c733fd Mon Sep 17 00:00:00 2001 From: Darkvater Date: Sun, 15 Oct 2006 17:01:19 +0000 Subject: (svn r6780) -Codechange: Remove GPMI leftovers (-b impersonisation of AI in MP). --- ai/ai.c | 22 +++------------------- ai/ai.h | 4 ---- ai/trolly/trolly.c | 4 +--- 3 files changed, 4 insertions(+), 26 deletions(-) (limited to 'ai') diff --git a/ai/ai.c b/ai/ai.c index 9072d8fe6..8068227d0 100644 --- a/ai/ai.c +++ b/ai/ai.c @@ -170,12 +170,8 @@ void AI_RunGameLoop(void) /* Don't do anything if ai is disabled */ if (!_ai.enabled) return; - /* Don't do anything if we are a network-client - * (too bad when a client joins, he thinks the AIs are real, so it wants to control - * them.. this avoids that, while loading a network game in singleplayer, does make - * the AIs to continue ;)) - */ - if (_networking && !_network_server && !_ai.network_client) return; + /* Don't do anything if we are a network-client */ + if (_networking && !_network_server) return; /* New tick */ _ai.tick++; @@ -185,11 +181,7 @@ void AI_RunGameLoop(void) if ((_ai.tick & ((1 << (4 - _opt.diff.competitor_speed)) - 1)) != 0) return; /* Check for AI-client (so joining a network with an AI) */ - if (_ai.network_client && _ai_player[_ai.network_playas].active) { - /* Run the script */ - AI_DequeueCommands(_ai.network_playas); - AI_RunTick(_ai.network_playas); - } else if (!_networking || _network_server) { + if (!_networking || _network_server) { /* Check if we want to run AIs (server or SP only) */ const Player* p; @@ -224,10 +216,6 @@ void AI_StartNewAI(PlayerID player) */ void AI_PlayerDied(PlayerID player) { - if (_ai.network_client && _ai.network_playas == player) { - _ai.network_playas = PLAYER_SPECTATOR; - } - /* Called if this AI died */ _ai_player[player].active = false; } @@ -237,16 +225,12 @@ void AI_PlayerDied(PlayerID player) */ void AI_Initialize(void) { - bool ai_network_client = _ai.network_client; - /* First, make sure all AIs are DEAD! */ AI_Uninitialize(); memset(&_ai, 0, sizeof(_ai)); memset(&_ai_player, 0, sizeof(_ai_player)); - _ai.network_client = ai_network_client; - _ai.network_playas = PLAYER_SPECTATOR; _ai.enabled = true; } diff --git a/ai/ai.h b/ai/ai.h index 440d3347a..aedb5b5cd 100644 --- a/ai/ai.h +++ b/ai/ai.h @@ -32,10 +32,6 @@ typedef struct AIStruct { /* General */ bool enabled; ///< Is AI enabled? uint tick; ///< The current tick (something like _frame_counter, only for AIs) - - /* For network-clients (a OpenTTD client who acts as an AI connected to a server) */ - bool network_client; ///< Are we a network_client? - uint8 network_playas; ///< The current network player we are connected as } AIStruct; VARDEF AIStruct _ai; diff --git a/ai/trolly/trolly.c b/ai/trolly/trolly.c index e15356379..d952975b9 100644 --- a/ai/trolly/trolly.c +++ b/ai/trolly/trolly.c @@ -48,9 +48,7 @@ static void AiNew_State_FirstTime(Player *p) assert(p->ainew.state == AI_STATE_FIRST_TIME); // We first have to init some things - if (_current_player == 1 || _ai.network_client) { - ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_IN_PROGRESS, 0, 0); - } + if (_current_player == 1) ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_IN_PROGRESS, 0, 0); // The PathFinder (AyStar) // TODO: Maybe when an AI goes bankrupt, this is de-init -- cgit v1.2.3-54-g00ecf