ai_event.hpp

Go to the documentation of this file.
00001 /* $Id: ai_event.hpp 20288 2010-08-01 20:41:46Z yexo $ */
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_EVENT_HPP
00013 #define AI_EVENT_HPP
00014 
00015 #include "ai_object.hpp"
00016 
00022 class AIEvent : public AIObject {
00023 public:
00025   static const char *GetClassName() { return "AIEvent"; }
00026 
00030   enum AIEventType {
00031     AI_ET_INVALID = 0,
00032     AI_ET_TEST,
00033     AI_ET_SUBSIDY_OFFER,
00034     AI_ET_SUBSIDY_OFFER_EXPIRED,
00035     AI_ET_SUBSIDY_AWARDED,
00036     AI_ET_SUBSIDY_EXPIRED,
00037     AI_ET_ENGINE_PREVIEW,
00038     AI_ET_COMPANY_NEW,
00039     AI_ET_COMPANY_IN_TROUBLE,
00040     AI_ET_COMPANY_ASK_MERGER,
00041     AI_ET_COMPANY_MERGER,
00042     AI_ET_COMPANY_BANKRUPT,
00043     AI_ET_VEHICLE_CRASHED,
00044     AI_ET_VEHICLE_LOST,
00045     AI_ET_VEHICLE_WAITING_IN_DEPOT,
00046     AI_ET_VEHICLE_UNPROFITABLE,
00047     AI_ET_INDUSTRY_OPEN,
00048     AI_ET_INDUSTRY_CLOSE,
00049     AI_ET_ENGINE_AVAILABLE,
00050     AI_ET_STATION_FIRST_VEHICLE,
00051     AI_ET_DISASTER_ZEPPELINER_CRASHED,
00052     AI_ET_DISASTER_ZEPPELINER_CLEARED,
00053   };
00054 
00058   AIEvent(AIEvent::AIEventType type) :
00059     type(type)
00060   {}
00061 
00066   AIEventType GetEventType() { return this->type; }
00067 
00068 protected:
00072   AIEventType type;
00073 };
00074 
00080 class AIEventController : public AIObject {
00081 public:
00086   static const char *GetClassName() { return "AIEventController"; }
00087 
00092   static bool IsEventWaiting();
00093 
00098   static AIEvent *GetNextEvent();
00099 
00100 #ifndef EXPORT_SKIP
00101 
00106   static void InsertEvent(AIEvent *event);
00107 
00112   static void FreeEventPointer();
00113 #endif /* EXPORT_SKIP */
00114 
00115 private:
00119   static void CreateEventPointer();
00120 };
00121 
00122 #endif /* AI_EVENT_HPP */

Generated on Thu Dec 23 23:41:22 2010 for OpenTTD by  doxygen 1.6.1