# ai_event_types.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_event_types.hpp 16511 2009-06-03 18:55:45Z rubidium $ */
    00002
    00005 #ifndef AI_EVENT_TYPES_HPP
    00006 #define AI_EVENT_TYPES_HPP
    00007
    00008 #include "ai_object.hpp"
    00009 #include "ai_event.hpp"
    00010 #include "ai_town.hpp"
    00011 #include "ai_industry.hpp"
    00012 #include "ai_engine.hpp"
    00013 #include "ai_subsidy.hpp"
    00014
    00019 class AIEventVehicleCrashed : public AIEvent {
    00020 public:
    00021   static const char *GetClassName() { return "AIEventVehicleCrashed"; }
    00022
    00026   enum CrashReason {
    00027     CRASH_TRAIN,
    00028     CRASH_RV_LEVEL_CROSSING,
    00029     CRASH_RV_UFO,
    00030     CRASH_PLANE_LANDING,
    00031     CRASH_AIRCRAFT_NO_AIRPORT,
    00032     CRASH_FLOODED,
    00033   };
    00034
    00040   AIEventVehicleCrashed(VehicleID vehicle, TileIndex crash_site, CrashReason crash_reason) :
    00041     AIEvent(AI_ET_VEHICLE_CRASHED),
    00042     crash_site(crash_site),
    00043     vehicle(vehicle),
    00044     crash_reason(crash_reason)
    00045   {}
    00046
    00052   static AIEventVehicleCrashed *Convert(AIEvent *instance) { return (AIEventVehicleCrashed *)instance; }
    00053
    00058   VehicleID GetVehicleID() { return vehicle; }
    00059
    00064   TileIndex GetCrashSite() { return crash_site; }
    00065
    00070   CrashReason GetCrashReason() { return crash_reason; }
    00071
    00072 private:
    00073   TileIndex crash_site;
    00074   VehicleID vehicle;
    00075   CrashReason crash_reason;
    00076 };
    00077
    00081 class AIEventSubsidyOffer : public AIEvent {
    00082 public:
    00083   static const char *GetClassName() { return "AIEventSubsidyOffer"; }
    00084
    00088   AIEventSubsidyOffer(SubsidyID subsidy_id) :
    00089     AIEvent(AI_ET_SUBSIDY_OFFER),
    00090     subsidy_id(subsidy_id)
    00091   {}
    00092
    00098   static AIEventSubsidyOffer *Convert(AIEvent *instance) { return (AIEventSubsidyOffer *)instance; }
    00099
    00104   SubsidyID GetSubsidyID() { return subsidy_id; }
    00105
    00106 private:
    00107   SubsidyID subsidy_id;
    00108 };
    00109
    00113 class AIEventSubsidyOfferExpired : public AIEvent {
    00114 public:
    00115   static const char *GetClassName() { return "AIEventSubsidyOfferExpired"; }
    00116
    00120   AIEventSubsidyOfferExpired(SubsidyID subsidy_id) :
    00121     AIEvent(AI_ET_SUBSIDY_OFFER_EXPIRED),
    00122     subsidy_id(subsidy_id)
    00123   {}
    00124
    00130   static AIEventSubsidyOfferExpired *Convert(AIEvent *instance) { return (AIEventSubsidyOfferExpired *)instance; }
    00131
    00136   SubsidyID GetSubsidyID() { return subsidy_id; }
    00137
    00138 private:
    00139   SubsidyID subsidy_id;
    00140 };
    00141
    00145 class AIEventSubsidyAwarded : public AIEvent {
    00146 public:
    00147   static const char *GetClassName() { return "AIEventSubsidyAwarded"; }
    00148
    00152   AIEventSubsidyAwarded(SubsidyID subsidy_id) :
    00153     AIEvent(AI_ET_SUBSIDY_AWARDED),
    00154     subsidy_id(subsidy_id)
    00155   {}
    00156
    00162   static AIEventSubsidyAwarded *Convert(AIEvent *instance) { return (AIEventSubsidyAwarded *)instance; }
    00163
    00168   SubsidyID GetSubsidyID() { return subsidy_id; }
    00169
    00170 private:
    00171   SubsidyID subsidy_id;
    00172 };
    00173
    00177 class AIEventSubsidyExpired : public AIEvent {
    00178 public:
    00179   static const char *GetClassName() { return "AIEventSubsidyExpired"; }
    00180
    00184   AIEventSubsidyExpired(SubsidyID subsidy_id) :
    00185     AIEvent(AI_ET_SUBSIDY_EXPIRED),
    00186     subsidy_id(subsidy_id)
    00187   {}
    00188
    00194   static AIEventSubsidyExpired *Convert(AIEvent *instance) { return (AIEventSubsidyExpired *)instance; }
    00195
    00200    SubsidyID GetSubsidyID() { return subsidy_id; }
    00201
    00202 private:
    00203   SubsidyID subsidy_id;
    00204 };
    00205
    00211 class AIEventEnginePreview : public AIEvent {
    00212 public:
    00213   static const char *GetClassName() { return "AIEventEnginePreview"; }
    00214
    00218   AIEventEnginePreview(EngineID engine) :
    00219     AIEvent(AI_ET_ENGINE_PREVIEW),
    00220     engine(engine)
    00221   {}
    00222
    00228   static AIEventEnginePreview *Convert(AIEvent *instance) { return (AIEventEnginePreview *)instance; }
    00229
    00234   char *GetName();
    00235
    00241   CargoID GetCargoType();
    00242
    00248   int32 GetCapacity();
    00249
    00257   int32 GetMaxSpeed();
    00258
    00263   Money GetPrice();
    00264
    00270   Money GetRunningCost();
    00271
    00276   AIVehicle::VehicleType GetVehicleType();
    00277
    00282   bool AcceptPreview();
    00283
    00284 private:
    00285   EngineID engine;
    00286 };
    00287
    00291 class AIEventCompanyNew : public AIEvent {
    00292 public:
    00293   static const char *GetClassName() { return "AIEventCompanyNew"; }
    00294
    00298   AIEventCompanyNew(Owner owner) :
    00299     AIEvent(AI_ET_COMPANY_NEW),
    00300     owner((AICompany::CompanyID)(byte)owner)
    00301   {}
    00302
    00308   static AIEventCompanyNew *Convert(AIEvent *instance) { return (AIEventCompanyNew *)instance; }
    00309
    00314   AICompany::CompanyID GetCompanyID() { return owner; }
    00315
    00316 private:
    00317   AICompany::CompanyID owner;
    00318 };
    00319
    00324 class AIEventCompanyInTrouble : public AIEvent {
    00325 public:
    00326   static const char *GetClassName() { return "AIEventCompanyInTrouble"; }
    00327
    00331   AIEventCompanyInTrouble(Owner owner) :
    00332     AIEvent(AI_ET_COMPANY_IN_TROUBLE),
    00333     owner((AICompany::CompanyID)(byte)owner)
    00334   {}
    00335
    00341   static AIEventCompanyInTrouble *Convert(AIEvent *instance) { return (AIEventCompanyInTrouble *)instance; }
    00342
    00347   AICompany::CompanyID GetCompanyID() { return owner; }
    00348
    00349 private:
    00350   AICompany::CompanyID owner;
    00351 };
    00352
    00357 class AIEventCompanyMerger : public AIEvent {
    00358 public:
    00359   static const char *GetClassName() { return "AIEventCompanyMerger"; }
    00360
    00365   AIEventCompanyMerger(Owner old_owner, Owner new_owner) :
    00366     AIEvent(AI_ET_COMPANY_MERGER),
    00367     old_owner((AICompany::CompanyID)(byte)old_owner),
    00368     new_owner((AICompany::CompanyID)(byte)new_owner)
    00369   {}
    00370
    00376   static AIEventCompanyMerger *Convert(AIEvent *instance) { return (AIEventCompanyMerger *)instance; }
    00377
    00385   AICompany::CompanyID GetOldCompanyID() { return old_owner; }
    00386
    00391   AICompany::CompanyID GetNewCompanyID() { return new_owner; }
    00392
    00393 private:
    00394   AICompany::CompanyID old_owner;
    00395   AICompany::CompanyID new_owner;
    00396 };
    00397
    00401 class AIEventCompanyBankrupt : public AIEvent {
    00402 public:
    00403   static const char *GetClassName() { return "AIEventCompanyBankrupt"; }
    00404
    00408   AIEventCompanyBankrupt(Owner owner) :
    00409     AIEvent(AI_ET_COMPANY_BANKRUPT),
    00410     owner((AICompany::CompanyID)(byte)owner)
    00411   {}
    00412
    00418   static AIEventCompanyBankrupt *Convert(AIEvent *instance) { return (AIEventCompanyBankrupt *)instance; }
    00419
    00424   AICompany::CompanyID GetCompanyID() { return owner; }
    00425
    00426 private:
    00427   AICompany::CompanyID owner;
    00428 };
    00429
    00433 class AIEventVehicleLost : public AIEvent {
    00434 public:
    00435   static const char *GetClassName() { return "AIEventVehicleLost"; }
    00436
    00440   AIEventVehicleLost(VehicleID vehicle_id) :
    00441     AIEvent(AI_ET_VEHICLE_LOST),
    00442     vehicle_id(vehicle_id)
    00443   {}
    00444
    00450   static AIEventVehicleLost *Convert(AIEvent *instance) { return (AIEventVehicleLost *)instance; }
    00451
    00456   VehicleID GetVehicleID() { return vehicle_id; }
    00457
    00458 private:
    00459   VehicleID vehicle_id;
    00460 };
    00461
    00465 class AIEventVehicleWaitingInDepot : public AIEvent {
    00466 public:
    00467   static const char *GetClassName() { return "AIEventVehicleWaitingInDepot"; }
    00468
    00472   AIEventVehicleWaitingInDepot(VehicleID vehicle_id) :
    00473     AIEvent(AI_ET_VEHICLE_WAITING_IN_DEPOT),
    00474     vehicle_id(vehicle_id)
    00475   {}
    00476
    00482   static AIEventVehicleWaitingInDepot *Convert(AIEvent *instance) { return (AIEventVehicleWaitingInDepot *)instance; }
    00483
    00488   VehicleID GetVehicleID() { return vehicle_id; }
    00489
    00490 private:
    00491   VehicleID vehicle_id;
    00492 };
    00493
    00497 class AIEventVehicleUnprofitable : public AIEvent {
    00498 public:
    00499   static const char *GetClassName() { return "AIEventVehicleUnprofitable"; }
    00500
    00504   AIEventVehicleUnprofitable(VehicleID vehicle_id) :
    00505     AIEvent(AI_ET_VEHICLE_UNPROFITABLE),
    00506     vehicle_id(vehicle_id)
    00507   {}
    00508
    00514   static AIEventVehicleUnprofitable *Convert(AIEvent *instance) { return (AIEventVehicleUnprofitable *)instance; }
    00515
    00520   VehicleID GetVehicleID() { return vehicle_id; }
    00521
    00522 private:
    00523   VehicleID vehicle_id;
    00524 };
    00525
    00529 class AIEventIndustryOpen : public AIEvent {
    00530 public:
    00531   static const char *GetClassName() { return "AIEventIndustryOpen"; }
    00532
    00536   AIEventIndustryOpen(IndustryID industry_id) :
    00537     AIEvent(AI_ET_INDUSTRY_OPEN),
    00538     industry_id(industry_id)
    00539   {}
    00540
    00546   static AIEventIndustryOpen *Convert(AIEvent *instance) { return (AIEventIndustryOpen *)instance; }
    00547
    00552   IndustryID GetIndustryID() { return industry_id; }
    00553
    00554 private:
    00555   IndustryID industry_id;
    00556 };
    00557
    00561 class AIEventIndustryClose : public AIEvent {
    00562 public:
    00563   static const char *GetClassName() { return "AIEventIndustryClose"; }
    00564
    00568   AIEventIndustryClose(IndustryID industry_id) :
    00569     AIEvent(AI_ET_INDUSTRY_CLOSE),
    00570     industry_id(industry_id)
    00571   {}
    00572
    00578   static AIEventIndustryClose *Convert(AIEvent *instance) { return (AIEventIndustryClose *)instance; }
    00579
    00584   IndustryID GetIndustryID() { return industry_id; }
    00585
    00586 private:
    00587   IndustryID industry_id;
    00588 };
    00589
    00593 class AIEventEngineAvailable : public AIEvent {
    00594 public:
    00595   static const char *GetClassName() { return "AIEventEngineAvailable"; }
    00596
    00600   AIEventEngineAvailable(EngineID engine) :
    00601     AIEvent(AI_ET_ENGINE_AVAILABLE),
    00602     engine(engine)
    00603   {}
    00604
    00610   static AIEventEngineAvailable *Convert(AIEvent *instance) { return (AIEventEngineAvailable *)instance; }
    00611
    00616   EngineID GetEngineID() { return engine; }
    00617
    00618 private:
    00619   EngineID engine;
    00620 };
    00621
    00625 class AIEventStationFirstVehicle : public AIEvent {
    00626 public:
    00627   static const char *GetClassName() { return "AIEventStationFirstVehicle"; }
    00628
    00633   AIEventStationFirstVehicle(StationID station, VehicleID vehicle) :
    00634     AIEvent(AI_ET_STATION_FIRST_VEHICLE),
    00635     station(station),
    00636     vehicle(vehicle)
    00637   {}
    00638
    00644   static AIEventStationFirstVehicle *Convert(AIEvent *instance) { return (AIEventStationFirstVehicle *)instance; }
    00645
    00650   StationID GetStationID() { return station; }
    00651
    00656   VehicleID GetVehicleID() { return vehicle; }
    00657
    00658 private:
    00659   StationID station;
    00660   VehicleID vehicle;
    00661 };
    00662
    00666 class AIEventDisasterZeppelinerCrashed : public AIEvent {
    00667 public:
    00668   static const char *GetClassName() { return "AIEventDisasterZeppelinerCrashed"; }
    00669
    00673   AIEventDisasterZeppelinerCrashed(StationID station) :
    00674     AIEvent(AI_ET_DISASTER_ZEPPELINER_CRASHED),
    00675     station(station)
    00676   {}
    00677
    00683   static AIEventDisasterZeppelinerCrashed *Convert(AIEvent *instance) { return (AIEventDisasterZeppelinerCrashed *)instance; }
    00684
    00689   StationID GetStationID() { return station; }
    00690
    00691 private:
    00692   StationID station;
    00693 };
    00694
    00698 class AIEventDisasterZeppelinerCleared : public AIEvent {
    00699 public:
    00700   static const char *GetClassName() { return "AIEventDisasterZeppelinerCleared"; }
    00701
    00705   AIEventDisasterZeppelinerCleared(StationID station) :
    00706     AIEvent(AI_ET_DISASTER_ZEPPELINER_CLEARED),
    00707     station(station)
    00708   {}
    00709
    00715   static AIEventDisasterZeppelinerCleared *Convert(AIEvent *instance) { return (AIEventDisasterZeppelinerCleared *)instance; }
    00716
    00721   StationID GetStationID() { return station; }
    00722
    00723 private:
    00724   StationID station;
    00725 };
    00726
    00727 #endif /* AI_EVENT_TYPES_HPP */