# ai_object.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_object.hpp 23257 2011-11-18 21:15: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 "../../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 friend class AIController;
    00041 #ifndef DOXYGEN_AI_DOCS
    00042 protected:
    00046   static bool DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text = NULL, AISuspendCallbackProc *callback = NULL);
    00047
    00051   static void SetDoCommandCosts(Money value);
    00052
    00056   static void IncreaseDoCommandCosts(Money value);
    00057
    00061   static Money GetDoCommandCosts();
    00062
    00066   static void SetLastError(AIErrorType last_error);
    00067
    00071   static AIErrorType GetLastError();
    00072
    00076   static void SetRoadType(RoadType road_type);
    00077
    00081   static RoadType GetRoadType();
    00082
    00086   static void SetRailType(RailType rail_type);
    00087
    00091   static RailType GetRailType();
    00092
    00096   static void SetDoCommandMode(AIModeProc *proc, AIObject *instance);
    00097
    00101   static AIModeProc *GetDoCommandMode();
    00102
    00106   static AIObject *GetDoCommandModeInstance();
    00107
    00111   static void SetDoCommandDelay(uint ticks);
    00112
    00116   static uint GetDoCommandDelay();
    00117
    00121   static bool GetLastCommandRes();
    00122
    00126   static VehicleID GetNewVehicleID();
    00127
    00131   static SignID GetNewSignID();
    00132
    00136   static TileIndex GetNewTunnelEndtile();
    00137
    00141   static GroupID GetNewGroupID();
    00142
    00146   static bool CanSuspend();
    00147
    00154   static bool GetAllowDoCommand();
    00155
    00159   static void *&GetEventPointer();
    00160
    00164   static void SetLastCost(Money last_cost);
    00165
    00169   static Money GetLastCost();
    00170
    00174   static void SetCallbackVariable(int index, int value);
    00175
    00179   static int GetCallbackVariable(int index);
    00180
    00181 public:
    00186   static void SetLastCommandRes(bool res);
    00187
    00192   static void SetNewVehicleID(VehicleID vehicle_id);
    00193
    00198   static void SetNewSignID(SignID sign_id);
    00199
    00204   static void SetNewTunnelEndtile(TileIndex tile);
    00205
    00210   static void SetNewGroupID(GroupID group_id);
    00211
    00216   static void SetAllowDoCommand(bool allow);
    00217
    00221   static void *&GetLogPointer();
    00222 #endif /* DOXYGEN_AI_DOCS */
    00223 };
    00224
    00225 #endif /* AI_OBJECT_HPP */