# ai_event.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_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     AI_ET_TOWN_FOUNDED,
    00054   };
    00055
    00059   AIEvent(AIEvent::AIEventType type) :
    00060     type(type)
    00061   {}
    00062
    00067   AIEventType GetEventType() { return this->type; }
    00068
    00069 protected:
    00073   AIEventType type;
    00074 };
    00075
    00081 class AIEventController : public AIObject {
    00082 public:
    00087   static const char *GetClassName() { return "AIEventController"; }
    00088
    00093   static bool IsEventWaiting();
    00094
    00099   static AIEvent *GetNextEvent();
    00100
    00101 #ifndef EXPORT_SKIP
    00102
    00107   static void InsertEvent(AIEvent *event);
    00108
    00113   static void FreeEventPointer();
    00114 #endif /* EXPORT_SKIP */
    00115
    00116 private:
    00120   static void CreateEventPointer();
    00121 };
    00122
    00123 #endif /* AI_EVENT_HPP */