# ai_object.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_object.hpp 15060 2009-01-13 15:44:36Z smatz $ */
    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 friend class AIController;
    00035 protected:
    00039   static bool DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text = NULL, AISuspendCallbackProc *callback = NULL);
    00040
    00044   static void SetDoCommandCosts(Money value);
    00045
    00049   static void IncreaseDoCommandCosts(Money value);
    00050
    00054   static Money GetDoCommandCosts();
    00055
    00059   static void SetLastError(AIErrorType last_error);
    00060
    00064   static AIErrorType GetLastError();
    00065
    00069   static void SetRoadType(RoadType road_type);
    00070
    00074   static RoadType GetRoadType();
    00075
    00079   static void SetRailType(RailType rail_type);
    00080
    00084   static RailType GetRailType();
    00085
    00089   static void SetDoCommandMode(AIModeProc *proc, AIObject *instance);
    00090
    00094   static AIModeProc *GetDoCommandMode();
    00095
    00099   static AIObject *GetDoCommandModeInstance();
    00100
    00104   static void SetDoCommandDelay(uint ticks);
    00105
    00109   static uint GetDoCommandDelay();
    00110
    00114   static bool GetLastCommandRes();
    00115
    00119   static VehicleID GetNewVehicleID();
    00120
    00124   static SignID GetNewSignID();
    00125
    00129   static TileIndex GetNewTunnelEndtile();
    00130
    00134   static GroupID GetNewGroupID();
    00135
    00140   static bool GetAllowDoCommand();
    00141
    00145   static void *&GetEventPointer();
    00146
    00147   static void SetLastCost(Money last_cost);
    00148   static Money GetLastCost();
    00149   static void SetCallbackVariable(int index, int value);
    00150   static int GetCallbackVariable(int index);
    00151
    00152 public:
    00158   static void SetLastCommandRes(bool res);
    00159
    00165   static void SetNewVehicleID(VehicleID vehicle_id);
    00166
    00172   static void SetNewSignID(SignID sign_id);
    00173
    00179   static void SetNewTunnelEndtile(TileIndex tile);
    00180
    00186   static void SetNewGroupID(GroupID group_id);
    00187
    00193   static void SetAllowDoCommand(bool allow);
    00194
    00199   static void *&GetLogPointer();
    00200 };
    00201
    00202 #endif /* AI_OBJECT_HPP */