# ai_object.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_object.hpp 16511 2009-06-03 18:55:45Z rubidium $ */
    00002
    00005 #ifndef AI_OBJECT_HPP
    00006 #define AI_OBJECT_HPP
    00007
    00008 #include "../../stdafx.h"
    00009 #include "../../misc/countedptr.hpp"
    00010 #include "../../road_type.h"
    00011 #include "../../rail_type.h"
    00012
    00013 #include "ai_types.hpp"
    00014
    00018 typedef void (AISuspendCallbackProc)(class AIInstance *instance);
    00019
    00023 typedef bool (AIModeProc)(TileIndex tile, uint32 p1, uint32 p2, uint cmd, CommandCost costs);
    00024
    00031 class AIObject : public SimpleCountedObject {
    00032 friend void CcAI(bool success, TileIndex tile, uint32 p1, uint32 p2);
    00033 friend class AIInstance;
    00034 protected:
    00038   static bool DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text = NULL, AISuspendCallbackProc *callback = NULL);
    00039
    00043   static void SetDoCommandCosts(Money value);
    00044
    00048   static void IncreaseDoCommandCosts(Money value);
    00049
    00053   static Money GetDoCommandCosts();
    00054
    00058   static void SetLastError(AIErrorType last_error);
    00059
    00063   static AIErrorType GetLastError();
    00064
    00068   static void SetRoadType(RoadType road_type);
    00069
    00073   static RoadType GetRoadType();
    00074
    00078   static void SetRailType(RailType rail_type);
    00079
    00083   static RailType GetRailType();
    00084
    00088   static void SetDoCommandMode(AIModeProc *proc, AIObject *instance);
    00089
    00093   static AIModeProc *GetDoCommandMode();
    00094
    00098   static AIObject *GetDoCommandModeInstance();
    00099
    00103   static void SetDoCommandDelay(uint ticks);
    00104
    00108   static uint GetDoCommandDelay();
    00109
    00113   static bool GetLastCommandRes();
    00114
    00118   static VehicleID GetNewVehicleID();
    00119
    00123   static SignID GetNewSignID();
    00124
    00128   static TileIndex GetNewTunnelEndtile();
    00129
    00133   static GroupID GetNewGroupID();
    00134
    00139   static bool GetAllowDoCommand();
    00140
    00144   static void *&GetEventPointer();
    00145
    00149   static void SetLastCost(Money last_cost);
    00150
    00154   static Money GetLastCost();
    00155
    00159   static void SetCallbackVariable(int index, int value);
    00160
    00164   static int GetCallbackVariable(int index);
    00165
    00166 public:
    00172   static void SetLastCommandRes(bool res);
    00173
    00179   static void SetNewVehicleID(VehicleID vehicle_id);
    00180
    00186   static void SetNewSignID(SignID sign_id);
    00187
    00193   static void SetNewTunnelEndtile(TileIndex tile);
    00194
    00200   static void SetNewGroupID(GroupID group_id);
    00201
    00207   static void SetAllowDoCommand(bool allow);
    00208
    00213   static void *&GetLogPointer();
    00214 };
    00215
    00216 #endif /* AI_OBJECT_HPP */