# ai_object.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_object.hpp 15558 2009-02-23 19:35:19Z yexo $ */
    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
    00146   static void SetLastCost(Money last_cost);
    00147   static Money GetLastCost();
    00148   static void SetCallbackVariable(int index, int value);
    00149   static int GetCallbackVariable(int index);
    00150
    00151 public:
    00157   static void SetLastCommandRes(bool res);
    00158
    00164   static void SetNewVehicleID(VehicleID vehicle_id);
    00165
    00171   static void SetNewSignID(SignID sign_id);
    00172
    00178   static void SetNewTunnelEndtile(TileIndex tile);
    00179
    00185   static void SetNewGroupID(GroupID group_id);
    00186
    00192   static void SetAllowDoCommand(bool allow);
    00193
    00198   static void *&GetLogPointer();
    00199 };
    00200
    00201 #endif /* AI_OBJECT_HPP */