AIObject Class Reference

Uper-parent object of all API classes. More...

Inheritance diagram for AIObject:

AIAbstractList AIAccounting AIAirport AIBase AIBaseStation AIBridge AICargo AICompany AIDate AIEngine AIError AIEvent AIEventController AIExecMode AIGameSettings AIGroup AIIndustry AIIndustryType AILog AIMap AIMarine AIOrder AIRail AIRoad AISign AISubsidy AITestMode AITile AITown AITunnel AIVehicle

Static Public Member Functions

static void SetLastCommandRes (bool res)
 Store the latest result of a DoCommand per company.
static void SetNewVehicleID (VehicleID vehicle_id)
 Store a new_vehicle_id per company.
static void SetNewSignID (SignID sign_id)
 Store a new_sign_id per company.
static void SetNewTunnelEndtile (TileIndex tile)
 Store a new_tunnel_endtile per company.
static void SetNewGroupID (GroupID group_id)
 Store a new_group_id per company.
static void SetAllowDoCommand (bool allow)
 Store a allow_do_command per company.
static void *& GetLogPointer ()
 Get the pointer to store log message in.

Static Protected Member Functions

static bool DoCommand (TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text=NULL, AISuspendCallbackProc *callback=NULL)
 Executes a raw DoCommand for the AI.
static void SetDoCommandCosts (Money value)
 Sets the DoCommand costs counter to a value.
static void IncreaseDoCommandCosts (Money value)
 Increase the current value of the DoCommand costs counter.
static Money GetDoCommandCosts ()
 Get the current DoCommand costs counter.
static void SetLastError (AIErrorType last_error)
 Set the DoCommand last error.
static AIErrorType GetLastError ()
 Get the DoCommand last error.
static void SetRoadType (RoadType road_type)
 Set the road type.
static RoadType GetRoadType ()
 Get the road type.
static void SetRailType (RailType rail_type)
 Set the rail type.
static RailType GetRailType ()
 Get the rail type.
static void SetDoCommandMode (AIModeProc *proc, AIObject *instance)
 Set the current mode of your AI to this proc.
static AIModeProcGetDoCommandMode ()
 Get the current mode your AI is currently under.
static AIObjectGetDoCommandModeInstance ()
 Get the instance of the current mode your AI is currently under.
static void SetDoCommandDelay (uint ticks)
 Set the delay of the DoCommand.
static uint GetDoCommandDelay ()
 Get the delay of the DoCommand.
static bool GetLastCommandRes ()
 Get the latest result of a DoCommand.
static VehicleID GetNewVehicleID ()
 Get the latest stored new_vehicle_id.
static SignID GetNewSignID ()
 Get the latest stored new_sign_id.
static TileIndex GetNewTunnelEndtile ()
 Get the latest stored new_tunnel_endtile.
static GroupID GetNewGroupID ()
 Get the latest stored new_group_id.
static bool CanSuspend ()
 Can we suspend the AI at this moment?
static bool GetAllowDoCommand ()
 Get the internal value of allow_do_command.
static void *& GetEventPointer ()
 Get the pointer to store event data in.
static void SetLastCost (Money last_cost)
 Set the cost of the last command.
static Money GetLastCost ()
 Get the cost of the last command.
static void SetCallbackVariable (int index, int value)
 Set a variable that can be used by callback functions to pass information.
static int GetCallbackVariable (int index)
 Get the variable that is used by callback functions to pass information.

Friends

class AIInstance
void CcAI (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)

Detailed Description

Uper-parent object of all API classes.

You should never use this class in your AI, as it doesn't publish any public functions. It is used internally to have a common place to handle general things, like internal command processing, and command-validation checks.


Member Function Documentation

static bool AIObject::GetAllowDoCommand (  )  [static, protected]

Get the internal value of allow_do_command.

This can differ from CanSuspend() if the reason we are not allowed to execute a DoCommand is in squirrel and not the API. In that case use this function to restore the previous value.

static void AIObject::SetLastCommandRes ( bool  res  )  [static]

Store the latest result of a DoCommand per company.

Note:
NEVER use this yourself in your AI!
Parameters:
res The result of the last command.

static void AIObject::SetNewVehicleID ( VehicleID  vehicle_id  )  [static]

Store a new_vehicle_id per company.

Note:
NEVER use this yourself in your AI!
Parameters:
vehicle_id The new VehicleID.

static void AIObject::SetNewSignID ( SignID  sign_id  )  [static]

Store a new_sign_id per company.

Note:
NEVER use this yourself in your AI!
Parameters:
sign_id The new SignID.

static void AIObject::SetNewTunnelEndtile ( TileIndex  tile  )  [static]

Store a new_tunnel_endtile per company.

Note:
NEVER use this yourself in your AI!
Parameters:
tile The new TileIndex.

static void AIObject::SetNewGroupID ( GroupID  group_id  )  [static]

Store a new_group_id per company.

Note:
NEVER use this yourself in your AI!
Parameters:
group_id The new GroupID.

static void AIObject::SetAllowDoCommand ( bool  allow  )  [static]

Store a allow_do_command per company.

Note:
NEVER use this yourself in your AI!
Parameters:
allow The new allow.

static void*& AIObject::GetLogPointer (  )  [static]

Get the pointer to store log message in.

Note:
NEVER use this yourself in your AI!


Generated on Wed Sep 15 14:11:49 2010 for OpenTTD NoAI API by  doxygen 1.5.6