src/ai/api/ai_execmode.cpp
author glx
Tue, 26 Jun 2007 23:40:58 +0000
branchnoai
changeset 9629 66dde6412125
parent 9486 a9b5f6b8667c
child 9833 89a64246458f
permissions -rw-r--r--
(svn r10350) [NoAI] -Sync with trunk r10194:10349
9450
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
     1
/* $Id$ */
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
     2
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
     3
/** @file ai_execmode.cpp class to switch the AI to Execute mode */
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
     4
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
     5
#include "ai_execmode.hpp"
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
     6
9629
66dde6412125 (svn r10350) [NoAI] -Sync with trunk r10194:10349
glx
parents: 9486
diff changeset
     7
bool AIExecMode::ModeProc(TileIndex tile, uint32 p1, uint32 p2, uint procc, CommandCost costs)
9450
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
     8
{
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
     9
	/* In execution mode we only return 'true', telling the DoCommand it
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
    10
	 *  should continue with the real execution of the command. */
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
    11
	return true;
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
    12
}
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
    13
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
    14
AIExecMode::AIExecMode()
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
    15
{
9473
dcbcd1c4496d (svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents: 9450
diff changeset
    16
	this->last_mode     = this->GetDoCommandMode();
dcbcd1c4496d (svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents: 9450
diff changeset
    17
	this->last_instance = this->GetDoCommandModeInstance();
dcbcd1c4496d (svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents: 9450
diff changeset
    18
	this->SetDoCommandMode(&AIExecMode::ModeProc, this);
9450
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
    19
}
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
    20
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
    21
AIExecMode::~AIExecMode()
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
    22
{
9473
dcbcd1c4496d (svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents: 9450
diff changeset
    23
	this->SetDoCommandMode(this->last_mode, this->last_instance);
9450
d675836e865c (svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
diff changeset
    24
}