(svn r12551) [NoAI] -Fix: remove unneeded AIObject:: (don't use AIObject:: inside the AIObject class ;))
--- a/src/ai/api/ai_object.cpp Thu Apr 03 13:28:46 2008 +0000
+++ b/src/ai/api/ai_object.cpp Thu Apr 03 22:09:54 2008 +0000
@@ -16,99 +16,99 @@
void AIObject::SetDoCommandDelay(uint ticks)
{
assert(ticks > 0);
- AIObject::GetDoCommandStruct(_current_player)->delay = ticks;
+ GetDoCommandStruct(_current_player)->delay = ticks;
}
uint AIObject::GetDoCommandDelay()
{
- return AIObject::GetDoCommandStruct(_current_player)->delay;
+ return GetDoCommandStruct(_current_player)->delay;
}
void AIObject::SetDoCommandMode(AIModeProc *proc, AIObject *instance)
{
- AIObject::GetDoCommandStruct(_current_player)->mode = proc;
- AIObject::GetDoCommandStruct(_current_player)->mode_instance = instance;
+ GetDoCommandStruct(_current_player)->mode = proc;
+ GetDoCommandStruct(_current_player)->mode_instance = instance;
}
AIModeProc *AIObject::GetDoCommandMode()
{
- return AIObject::GetDoCommandStruct(_current_player)->mode;
+ return GetDoCommandStruct(_current_player)->mode;
}
AIObject *AIObject::GetDoCommandModeInstance()
{
- return AIObject::GetDoCommandStruct(_current_player)->mode_instance;
+ return GetDoCommandStruct(_current_player)->mode_instance;
}
void AIObject::SetDoCommandCosts(Money value)
{
- AIObject::GetDoCommandStruct(_current_player)->costs = CommandCost(value);
+ GetDoCommandStruct(_current_player)->costs = CommandCost(value);
}
void AIObject::IncreaseDoCommandCosts(Money value)
{
- AIObject::GetDoCommandStruct(_current_player)->costs.AddCost(value);
+ GetDoCommandStruct(_current_player)->costs.AddCost(value);
}
Money AIObject::GetDoCommandCosts()
{
- return AIObject::GetDoCommandStruct(_current_player)->costs.GetCost();
+ return GetDoCommandStruct(_current_player)->costs.GetCost();
}
void AIObject::SetLastError(const StringID last_error)
{
- AIObject::GetDoCommandStruct(_current_player)->last_error = last_error;
+ GetDoCommandStruct(_current_player)->last_error = last_error;
}
StringID AIObject::GetLastError()
{
- return AIObject::GetDoCommandStruct(_current_player)->last_error;
+ return GetDoCommandStruct(_current_player)->last_error;
}
void AIObject::SetLastCommandRes(bool res)
{
- AIObject::GetDoCommandStruct(_current_player)->last_command_res = res;
+ GetDoCommandStruct(_current_player)->last_command_res = res;
}
bool AIObject::GetLastCommandRes()
{
- return AIObject::GetDoCommandStruct(_current_player)->last_command_res;
+ return GetDoCommandStruct(_current_player)->last_command_res;
}
void AIObject::SetNewVehicleID(VehicleID vehicle_id)
{
- AIObject::GetDoCommandStruct(_current_player)->new_vehicle_id = vehicle_id;
+ GetDoCommandStruct(_current_player)->new_vehicle_id = vehicle_id;
}
VehicleID AIObject::GetNewVehicleID()
{
- return AIObject::GetDoCommandStruct(_current_player)->new_vehicle_id;
+ return GetDoCommandStruct(_current_player)->new_vehicle_id;
}
void AIObject::SetNewSignID(SignID sign_id)
{
- AIObject::GetDoCommandStruct(_current_player)->new_sign_id = sign_id;
+ GetDoCommandStruct(_current_player)->new_sign_id = sign_id;
}
SignID AIObject::GetNewSignID()
{
- return AIObject::GetDoCommandStruct(_current_player)->new_sign_id;
+ return GetDoCommandStruct(_current_player)->new_sign_id;
}
void *&AIObject::GetEventPointer()
{
- return AIObject::GetDoCommandStruct(_current_player)->event_data;
+ return GetDoCommandStruct(_current_player)->event_data;
}
void *&AIObject::GetLogPointer()
{
- return AIObject::GetDoCommandStruct(_current_player)->log_data;
+ return GetDoCommandStruct(_current_player)->log_data;
}
AIObject::AIDoCommandStruct *AIObject::GetDoCommandStruct(PlayerID player)
{
/* Storage for data on per-AI level */
- static AIObject::AIDoCommandStruct command_struct[MAX_PLAYERS];
+ static AIDoCommandStruct command_struct[MAX_PLAYERS];
static bool initialized = false;
/* Make sure all memory is NULL when we start */
@@ -122,7 +122,7 @@
void AIObject::ResetInternalPlayerData()
{
- AIObject::AIDoCommandStruct *command_struct = GetDoCommandStruct(_current_player);
+ AIDoCommandStruct *command_struct = GetDoCommandStruct(_current_player);
command_struct->mode = NULL;
command_struct->delay = 1;
command_struct->costs = CommandCost();
@@ -160,8 +160,8 @@
_cmd_text = tmp_cmdtext;
/* Check what the callback wants us to do */
- if (AIObject::GetDoCommandMode() != NULL && !AIObject::GetDoCommandMode()(tile, p1, p2, procc, res)) {
- AIObject::IncreaseDoCommandCosts(res.GetCost());
+ if (GetDoCommandMode() != NULL && !GetDoCommandMode()(tile, p1, p2, procc, res)) {
+ IncreaseDoCommandCosts(res.GetCost());
return true;
}
@@ -180,9 +180,9 @@
_local_player = old_lp;
/* Suspend the AI till the command is really executed */
- AI_SuspendPlayer(_current_player, -(int)AIObject::GetDoCommandDelay());
+ ::AI_SuspendPlayer(_current_player, -(int)GetDoCommandDelay());
/* Check if the callback still agrees with us, else return error */
- if (!AIObject::GetLastCommandRes()) res = CMD_ERROR;
+ if (!GetLastCommandRes()) res = CMD_ERROR;
} else {
#else
{
@@ -190,11 +190,11 @@
/* For SinglePlayer we execute the command immediatly */
::DoCommandP(tile, p1, p2, NULL, procc);
/* Store some values inside the AIObject static memory */
- AIObject::SetNewVehicleID(_new_vehicle_id);
- AIObject::SetNewSignID(_new_sign_id);
+ SetNewVehicleID(_new_vehicle_id);
+ SetNewSignID(_new_sign_id);
/* Suspend the AI player for 1 tick, so it simulates MultiPlayer */
- AI_SuspendPlayer(_current_player, AIObject::GetDoCommandDelay());
+ ::AI_SuspendPlayer(_current_player, GetDoCommandDelay());
}
if (::CmdFailed(res)) {
@@ -202,6 +202,6 @@
return false;
}
- AIObject::IncreaseDoCommandCosts(res.GetCost());
+ IncreaseDoCommandCosts(res.GetCost());
return true;
}