(svn r3226) -Fix: GPMI implementation had minor glitches

-Fix: the AI speed control is done by the AI-core, individual AIs don't have to do it (so, AIs were delayed twice ;)
-Add: Support for AI-network-clients (an AI, connecting to a remote server)
-Fix: minor AI-core problems
This commit is contained in:
truelight
2005-11-22 15:55:38 +00:00
parent 28df667ceb
commit e4cb8ed457
8 changed files with 64 additions and 57 deletions

View File

@@ -44,7 +44,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) {
if (_current_player == 1 || _ai.network_client) {
ShowErrorMessage(-1, TEMP_AI_IN_PROGRESS, 0, 0);
}
@@ -1347,9 +1347,6 @@ static void AiNew_OnTick(Player *p)
void AiNewDoGameLoop(Player *p)
{
// If it is a human player, it is not an AI, so bubye!
if (IS_HUMAN_PLAYER(_current_player)) return;
if (p->ainew.state == AI_STATE_STARTUP) {
// The AI just got alive!
p->ainew.state = AI_STATE_FIRST_TIME;
@@ -1362,29 +1359,6 @@ void AiNewDoGameLoop(Player *p)
// We keep a ticker. We use it for competitor_speed
p->ainew.tick++;
// See what the speed is
switch (_opt.diff.competitor_speed) {
case 0: // Very slow
if (!(p->ainew.tick&8)) return;
break;
case 1: // Slow
if (!(p->ainew.tick&4)) return;
break;
case 2:
if (!(p->ainew.tick&2)) return;
break;
case 3:
if (!(p->ainew.tick&1)) return;
break;
case 4: // Very fast
default: // Cool, a new speed setting.. ;) VERY fast ;)
break;
}
// If we come here, we can do a tick.. do so!
AiNew_OnTick(p);
}