# ai_event.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_event.hpp 15684 2009-03-12 11:43:40Z yexo $ */
    00002
    00005 #ifndef AI_EVENT_HPP
    00006 #define AI_EVENT_HPP
    00007
    00008 #include "ai_object.hpp"
    00009
    00015 class AIEvent : public AIObject {
    00016 public:
    00017   static const char *GetClassName() { return "AIEvent"; }
    00018
    00022   enum AIEventType {
    00023     AI_ET_INVALID = 0,
    00024     AI_ET_TEST,
    00025     AI_ET_SUBSIDY_OFFER,
    00026     AI_ET_SUBSIDY_OFFER_EXPIRED,
    00027     AI_ET_SUBSIDY_AWARDED,
    00028     AI_ET_SUBSIDY_EXPIRED,
    00029     AI_ET_ENGINE_PREVIEW,
    00030     AI_ET_COMPANY_NEW,
    00031     AI_ET_COMPANY_IN_TROUBLE,
    00032     AI_ET_COMPANY_MERGER,
    00033     AI_ET_COMPANY_BANKRUPT,
    00034     AI_ET_VEHICLE_CRASHED,
    00035     AI_ET_VEHICLE_LOST,
    00036     AI_ET_VEHICLE_WAITING_IN_DEPOT,
    00037     AI_ET_VEHICLE_UNPROFITABLE,
    00038     AI_ET_INDUSTRY_OPEN,
    00039     AI_ET_INDUSTRY_CLOSE,
    00040     AI_ET_ENGINE_AVAILABLE,
    00041     AI_ET_STATION_FIRST_VEHICLE,
    00042     AI_ET_DISASTER_ZEPPELINER_CRASHED,
    00043     AI_ET_DISASTER_ZEPPELINER_CLEARED,
    00044   };
    00045
    00049   AIEvent(AIEvent::AIEventType type) :
    00050     type(type)
    00051   {}
    00052
    00057   AIEventType GetEventType() { return this->type; }
    00058
    00059 protected:
    00063   AIEventType type;
    00064 };
    00065
    00071 class AIEventController : public AIObject {
    00072 public:
    00076   static const char *GetClassName() { return "AIEventController"; }
    00077
    00082   static bool IsEventWaiting();
    00083
    00088   static AIEvent *GetNextEvent();
    00089
    00090 #ifndef EXPORT_SKIP
    00091
    00096   static void InsertEvent(AIEvent *event);
    00097
    00102   static void FreeEventPointer();
    00103 #endif /* EXPORT_SKIP */
    00104
    00105 private:
    00109   static void CreateEventPointer();
    00110 };
    00111
    00112 #endif /* AI_EVENT_HPP */