# ai_object.hpp

Go to the documentation of this file.

    00001 /* $Id$ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef AI_OBJECT_HPP
    00013 #define AI_OBJECT_HPP
    00014
    00015 #include "../../misc/countedptr.hpp"
    00016 #include "../../road_type.h"
    00017 #include "../../rail_type.h"
    00018
    00019 #include "ai_types.hpp"
    00020
    00024 typedef void (AISuspendCallbackProc)(class AIInstance *instance);
    00025
    00029 typedef bool (AIModeProc)();
    00030
    00037 class AIObject : public SimpleCountedObject {
    00038 friend void CcAI(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2);
    00039 friend class AIInstance;
    00040 protected:
    00044   static bool DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text = NULL, AISuspendCallbackProc *callback = NULL);
    00045
    00049   static void SetDoCommandCosts(Money value);
    00050
    00054   static void IncreaseDoCommandCosts(Money value);
    00055
    00059   static Money GetDoCommandCosts();
    00060
    00064   static void SetLastError(AIErrorType last_error);
    00065
    00069   static AIErrorType GetLastError();
    00070
    00074   static void SetRoadType(RoadType road_type);
    00075
    00079   static RoadType GetRoadType();
    00080
    00084   static void SetRailType(RailType rail_type);
    00085
    00089   static RailType GetRailType();
    00090
    00094   static void SetDoCommandMode(AIModeProc *proc, AIObject *instance);
    00095
    00099   static AIModeProc *GetDoCommandMode();
    00100
    00104   static AIObject *GetDoCommandModeInstance();
    00105
    00109   static void SetDoCommandDelay(uint ticks);
    00110
    00114   static uint GetDoCommandDelay();
    00115
    00119   static bool GetLastCommandRes();
    00120
    00124   static VehicleID GetNewVehicleID();
    00125
    00129   static SignID GetNewSignID();
    00130
    00134   static TileIndex GetNewTunnelEndtile();
    00135
    00139   static GroupID GetNewGroupID();
    00140
    00144   static bool CanSuspend();
    00145
    00152   static bool GetAllowDoCommand();
    00153
    00157   static void *&GetEventPointer();
    00158
    00162   static void SetLastCost(Money last_cost);
    00163
    00167   static Money GetLastCost();
    00168
    00172   static void SetCallbackVariable(int index, int value);
    00173
    00177   static int GetCallbackVariable(int index);
    00178
    00179 public:
    00185   static void SetLastCommandRes(bool res);
    00186
    00192   static void SetNewVehicleID(VehicleID vehicle_id);
    00193
    00199   static void SetNewSignID(SignID sign_id);
    00200
    00206   static void SetNewTunnelEndtile(TileIndex tile);
    00207
    00213   static void SetNewGroupID(GroupID group_id);
    00214
    00220   static void SetAllowDoCommand(bool allow);
    00221
    00226   static void *&GetLogPointer();
    00227 };
    00228
    00229 #endif /* AI_OBJECT_HPP */