ai_event.hpp

Go to the documentation of this file.
00001 /* $Id: ai_event.hpp 17345 2009-09-01 12:57:04Z 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_EVENT_HPP
00013 #define AI_EVENT_HPP
00014 
00015 #include "ai_object.hpp"
00016 
00022 class AIEvent : public AIObject {
00023 public:
00024   static const char *GetClassName() { return "AIEvent"; }
00025 
00029   enum AIEventType {
00030     AI_ET_INVALID = 0,
00031     AI_ET_TEST,
00032     AI_ET_SUBSIDY_OFFER,
00033     AI_ET_SUBSIDY_OFFER_EXPIRED,
00034     AI_ET_SUBSIDY_AWARDED,
00035     AI_ET_SUBSIDY_EXPIRED,
00036     AI_ET_ENGINE_PREVIEW,
00037     AI_ET_COMPANY_NEW,
00038     AI_ET_COMPANY_IN_TROUBLE,
00039     AI_ET_COMPANY_ASK_MERGER,
00040     AI_ET_COMPANY_MERGER,
00041     AI_ET_COMPANY_BANKRUPT,
00042     AI_ET_VEHICLE_CRASHED,
00043     AI_ET_VEHICLE_LOST,
00044     AI_ET_VEHICLE_WAITING_IN_DEPOT,
00045     AI_ET_VEHICLE_UNPROFITABLE,
00046     AI_ET_INDUSTRY_OPEN,
00047     AI_ET_INDUSTRY_CLOSE,
00048     AI_ET_ENGINE_AVAILABLE,
00049     AI_ET_STATION_FIRST_VEHICLE,
00050     AI_ET_DISASTER_ZEPPELINER_CRASHED,
00051     AI_ET_DISASTER_ZEPPELINER_CLEARED,
00052   };
00053 
00057   AIEvent(AIEvent::AIEventType type) :
00058     type(type)
00059   {}
00060 
00065   AIEventType GetEventType() { return this->type; }
00066 
00067 protected:
00071   AIEventType type;
00072 };
00073 
00079 class AIEventController : public AIObject {
00080 public:
00084   static const char *GetClassName() { return "AIEventController"; }
00085 
00090   static bool IsEventWaiting();
00091 
00096   static AIEvent *GetNextEvent();
00097 
00098 #ifndef EXPORT_SKIP
00099 
00104   static void InsertEvent(AIEvent *event);
00105 
00110   static void FreeEventPointer();
00111 #endif /* EXPORT_SKIP */
00112 
00113 private:
00117   static void CreateEventPointer();
00118 };
00119 
00120 #endif /* AI_EVENT_HPP */

Generated on Wed Jan 20 23:38:33 2010 for OpenTTD by  doxygen 1.5.6