# ai_object.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_object.hpp 18781 2010-01-11 18:46:09Z rubidium $ */
    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 "../../stdafx.h"
    00016 #include "../../misc/countedptr.hpp"
    00017 #include "../../road_type.h"
    00018 #include "../../rail_type.h"
    00019
    00020 #include "ai_types.hpp"
    00021
    00025 typedef void (AISuspendCallbackProc)(class AIInstance *instance);
    00026
    00030 typedef bool (AIModeProc)();
    00031
    00038 class AIObject : public SimpleCountedObject {
    00039 friend void CcAI(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2);
    00040 friend class AIInstance;
    00041 protected:
    00045   static bool DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text = NULL, AISuspendCallbackProc *callback = NULL);
    00046
    00050   static void SetDoCommandCosts(Money value);
    00051
    00055   static void IncreaseDoCommandCosts(Money value);
    00056
    00060   static Money GetDoCommandCosts();
    00061
    00065   static void SetLastError(AIErrorType last_error);
    00066
    00070   static AIErrorType GetLastError();
    00071
    00075   static void SetRoadType(RoadType road_type);
    00076
    00080   static RoadType GetRoadType();
    00081
    00085   static void SetRailType(RailType rail_type);
    00086
    00090   static RailType GetRailType();
    00091
    00095   static void SetDoCommandMode(AIModeProc *proc, AIObject *instance);
    00096
    00100   static AIModeProc *GetDoCommandMode();
    00101
    00105   static AIObject *GetDoCommandModeInstance();
    00106
    00110   static void SetDoCommandDelay(uint ticks);
    00111
    00115   static uint GetDoCommandDelay();
    00116
    00120   static bool GetLastCommandRes();
    00121
    00125   static VehicleID GetNewVehicleID();
    00126
    00130   static SignID GetNewSignID();
    00131
    00135   static TileIndex GetNewTunnelEndtile();
    00136
    00140   static GroupID GetNewGroupID();
    00141
    00145   static bool CanSuspend();
    00146
    00153   static bool GetAllowDoCommand();
    00154
    00158   static void *&GetEventPointer();
    00159
    00163   static void SetLastCost(Money last_cost);
    00164
    00168   static Money GetLastCost();
    00169
    00173   static void SetCallbackVariable(int index, int value);
    00174
    00178   static int GetCallbackVariable(int index);
    00179
    00180 public:
    00186   static void SetLastCommandRes(bool res);
    00187
    00193   static void SetNewVehicleID(VehicleID vehicle_id);
    00194
    00200   static void SetNewSignID(SignID sign_id);
    00201
    00207   static void SetNewTunnelEndtile(TileIndex tile);
    00208
    00214   static void SetNewGroupID(GroupID group_id);
    00215
    00221   static void SetAllowDoCommand(bool allow);
    00222
    00227   static void *&GetLogPointer();
    00228 };
    00229
    00230 #endif /* AI_OBJECT_HPP */