# ai_object.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_object.hpp 17517 2009-09-12 20:59:34Z 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
    00138   static bool CanSuspend();
    00139
    00146   static bool GetAllowDoCommand();
    00147
    00151   static void *&GetEventPointer();
    00152
    00156   static void SetLastCost(Money last_cost);
    00157
    00161   static Money GetLastCost();
    00162
    00166   static void SetCallbackVariable(int index, int value);
    00167
    00171   static int GetCallbackVariable(int index);
    00172
    00173 public:
    00179   static void SetLastCommandRes(bool res);
    00180
    00186   static void SetNewVehicleID(VehicleID vehicle_id);
    00187
    00193   static void SetNewSignID(SignID sign_id);
    00194
    00200   static void SetNewTunnelEndtile(TileIndex tile);
    00201
    00207   static void SetNewGroupID(GroupID group_id);
    00208
    00214   static void SetAllowDoCommand(bool allow);
    00215
    00220   static void *&GetLogPointer();
    00221 };
    00222
    00223 #endif /* AI_OBJECT_HPP */