ai_event_types.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef AI_EVENT_TYPES_HPP
00013 #define AI_EVENT_TYPES_HPP
00014
00015 #include "ai_event.hpp"
00016 #include "ai_company.hpp"
00017
00022 class AIEventVehicleCrashed : public AIEvent {
00023 public:
00025 static const char *GetClassName() { return "AIEventVehicleCrashed"; }
00026
00030 enum CrashReason {
00031 CRASH_TRAIN,
00032 CRASH_RV_LEVEL_CROSSING,
00033 CRASH_RV_UFO,
00034 CRASH_PLANE_LANDING,
00035 CRASH_AIRCRAFT_NO_AIRPORT,
00036 CRASH_FLOODED,
00037 };
00038
00044 AIEventVehicleCrashed(VehicleID vehicle, TileIndex crash_site, CrashReason crash_reason) :
00045 AIEvent(AI_ET_VEHICLE_CRASHED),
00046 crash_site(crash_site),
00047 vehicle(vehicle),
00048 crash_reason(crash_reason)
00049 {}
00050
00056 static AIEventVehicleCrashed *Convert(AIEvent *instance) { return (AIEventVehicleCrashed *)instance; }
00057
00062 VehicleID GetVehicleID() { return this->vehicle; }
00063
00068 TileIndex GetCrashSite() { return this->crash_site; }
00069
00074 CrashReason GetCrashReason() { return this->crash_reason; }
00075
00076 private:
00077 TileIndex crash_site;
00078 VehicleID vehicle;
00079 CrashReason crash_reason;
00080 };
00081
00085 class AIEventSubsidyOffer : public AIEvent {
00086 public:
00088 static const char *GetClassName() { return "AIEventSubsidyOffer"; }
00089
00093 AIEventSubsidyOffer(SubsidyID subsidy_id) :
00094 AIEvent(AI_ET_SUBSIDY_OFFER),
00095 subsidy_id(subsidy_id)
00096 {}
00097
00103 static AIEventSubsidyOffer *Convert(AIEvent *instance) { return (AIEventSubsidyOffer *)instance; }
00104
00109 SubsidyID GetSubsidyID() { return this->subsidy_id; }
00110
00111 private:
00112 SubsidyID subsidy_id;
00113 };
00114
00118 class AIEventSubsidyOfferExpired : public AIEvent {
00119 public:
00121 static const char *GetClassName() { return "AIEventSubsidyOfferExpired"; }
00122
00126 AIEventSubsidyOfferExpired(SubsidyID subsidy_id) :
00127 AIEvent(AI_ET_SUBSIDY_OFFER_EXPIRED),
00128 subsidy_id(subsidy_id)
00129 {}
00130
00136 static AIEventSubsidyOfferExpired *Convert(AIEvent *instance) { return (AIEventSubsidyOfferExpired *)instance; }
00137
00142 SubsidyID GetSubsidyID() { return this->subsidy_id; }
00143
00144 private:
00145 SubsidyID subsidy_id;
00146 };
00147
00151 class AIEventSubsidyAwarded : public AIEvent {
00152 public:
00154 static const char *GetClassName() { return "AIEventSubsidyAwarded"; }
00155
00159 AIEventSubsidyAwarded(SubsidyID subsidy_id) :
00160 AIEvent(AI_ET_SUBSIDY_AWARDED),
00161 subsidy_id(subsidy_id)
00162 {}
00163
00169 static AIEventSubsidyAwarded *Convert(AIEvent *instance) { return (AIEventSubsidyAwarded *)instance; }
00170
00175 SubsidyID GetSubsidyID() { return this->subsidy_id; }
00176
00177 private:
00178 SubsidyID subsidy_id;
00179 };
00180
00184 class AIEventSubsidyExpired : public AIEvent {
00185 public:
00187 static const char *GetClassName() { return "AIEventSubsidyExpired"; }
00188
00192 AIEventSubsidyExpired(SubsidyID subsidy_id) :
00193 AIEvent(AI_ET_SUBSIDY_EXPIRED),
00194 subsidy_id(subsidy_id)
00195 {}
00196
00202 static AIEventSubsidyExpired *Convert(AIEvent *instance) { return (AIEventSubsidyExpired *)instance; }
00203
00208 SubsidyID GetSubsidyID() { return this->subsidy_id; }
00209
00210 private:
00211 SubsidyID subsidy_id;
00212 };
00213
00219 class AIEventEnginePreview : public AIEvent {
00220 public:
00222 static const char *GetClassName() { return "AIEventEnginePreview"; }
00223
00227 AIEventEnginePreview(EngineID engine) :
00228 AIEvent(AI_ET_ENGINE_PREVIEW),
00229 engine(engine)
00230 {}
00231
00237 static AIEventEnginePreview *Convert(AIEvent *instance) { return (AIEventEnginePreview *)instance; }
00238
00243 char *GetName();
00244
00250 CargoID GetCargoType();
00251
00257 int32 GetCapacity();
00258
00266 int32 GetMaxSpeed();
00267
00272 Money GetPrice();
00273
00279 Money GetRunningCost();
00280
00285 #ifdef DOXYGEN_SKIP
00286 AIVehicle::VehicleType GetVehicleType();
00287 #else
00288 int32 GetVehicleType();
00289 #endif
00290
00295 bool AcceptPreview();
00296
00297 private:
00298 EngineID engine;
00299
00304 bool IsEngineValid() const;
00305 };
00306
00310 class AIEventCompanyNew : public AIEvent {
00311 public:
00313 static const char *GetClassName() { return "AIEventCompanyNew"; }
00314
00318 AIEventCompanyNew(Owner owner) :
00319 AIEvent(AI_ET_COMPANY_NEW),
00320 owner((AICompany::CompanyID)owner)
00321 {}
00322
00328 static AIEventCompanyNew *Convert(AIEvent *instance) { return (AIEventCompanyNew *)instance; }
00329
00334 AICompany::CompanyID GetCompanyID() { return this->owner; }
00335
00336 private:
00337 AICompany::CompanyID owner;
00338 };
00339
00344 class AIEventCompanyInTrouble : public AIEvent {
00345 public:
00347 static const char *GetClassName() { return "AIEventCompanyInTrouble"; }
00348
00352 AIEventCompanyInTrouble(Owner owner) :
00353 AIEvent(AI_ET_COMPANY_IN_TROUBLE),
00354 owner((AICompany::CompanyID)owner)
00355 {}
00356
00362 static AIEventCompanyInTrouble *Convert(AIEvent *instance) { return (AIEventCompanyInTrouble *)instance; }
00363
00368 AICompany::CompanyID GetCompanyID() { return this->owner; }
00369
00370 private:
00371 AICompany::CompanyID owner;
00372 };
00373
00377 class AIEventCompanyAskMerger : public AIEvent {
00378 public:
00380 static const char *GetClassName() { return "AIEventCompanyAskMerger"; }
00381
00386 AIEventCompanyAskMerger(Owner owner, int32 value) :
00387 AIEvent(AI_ET_COMPANY_ASK_MERGER),
00388 owner((AICompany::CompanyID)owner),
00389 value(value)
00390 {}
00391
00397 static AIEventCompanyAskMerger *Convert(AIEvent *instance) { return (AIEventCompanyAskMerger *)instance; }
00398
00404 AICompany::CompanyID GetCompanyID() { return this->owner; }
00405
00410 int32 GetValue() { return this->value; }
00411
00416 bool AcceptMerger();
00417
00418 private:
00419 AICompany::CompanyID owner;
00420 int32 value;
00421 };
00422
00427 class AIEventCompanyMerger : public AIEvent {
00428 public:
00430 static const char *GetClassName() { return "AIEventCompanyMerger"; }
00431
00436 AIEventCompanyMerger(Owner old_owner, Owner new_owner) :
00437 AIEvent(AI_ET_COMPANY_MERGER),
00438 old_owner((AICompany::CompanyID)old_owner),
00439 new_owner((AICompany::CompanyID)new_owner)
00440 {}
00441
00447 static AIEventCompanyMerger *Convert(AIEvent *instance) { return (AIEventCompanyMerger *)instance; }
00448
00456 AICompany::CompanyID GetOldCompanyID() { return this->old_owner; }
00457
00462 AICompany::CompanyID GetNewCompanyID() { return this->new_owner; }
00463
00464 private:
00465 AICompany::CompanyID old_owner;
00466 AICompany::CompanyID new_owner;
00467 };
00468
00472 class AIEventCompanyBankrupt : public AIEvent {
00473 public:
00475 static const char *GetClassName() { return "AIEventCompanyBankrupt"; }
00476
00480 AIEventCompanyBankrupt(Owner owner) :
00481 AIEvent(AI_ET_COMPANY_BANKRUPT),
00482 owner((AICompany::CompanyID)owner)
00483 {}
00484
00490 static AIEventCompanyBankrupt *Convert(AIEvent *instance) { return (AIEventCompanyBankrupt *)instance; }
00491
00496 AICompany::CompanyID GetCompanyID() { return this->owner; }
00497
00498 private:
00499 AICompany::CompanyID owner;
00500 };
00501
00505 class AIEventVehicleLost : public AIEvent {
00506 public:
00508 static const char *GetClassName() { return "AIEventVehicleLost"; }
00509
00513 AIEventVehicleLost(VehicleID vehicle_id) :
00514 AIEvent(AI_ET_VEHICLE_LOST),
00515 vehicle_id(vehicle_id)
00516 {}
00517
00523 static AIEventVehicleLost *Convert(AIEvent *instance) { return (AIEventVehicleLost *)instance; }
00524
00529 VehicleID GetVehicleID() { return this->vehicle_id; }
00530
00531 private:
00532 VehicleID vehicle_id;
00533 };
00534
00538 class AIEventVehicleWaitingInDepot : public AIEvent {
00539 public:
00541 static const char *GetClassName() { return "AIEventVehicleWaitingInDepot"; }
00542
00546 AIEventVehicleWaitingInDepot(VehicleID vehicle_id) :
00547 AIEvent(AI_ET_VEHICLE_WAITING_IN_DEPOT),
00548 vehicle_id(vehicle_id)
00549 {}
00550
00556 static AIEventVehicleWaitingInDepot *Convert(AIEvent *instance) { return (AIEventVehicleWaitingInDepot *)instance; }
00557
00562 VehicleID GetVehicleID() { return this->vehicle_id; }
00563
00564 private:
00565 VehicleID vehicle_id;
00566 };
00567
00571 class AIEventVehicleUnprofitable : public AIEvent {
00572 public:
00574 static const char *GetClassName() { return "AIEventVehicleUnprofitable"; }
00575
00579 AIEventVehicleUnprofitable(VehicleID vehicle_id) :
00580 AIEvent(AI_ET_VEHICLE_UNPROFITABLE),
00581 vehicle_id(vehicle_id)
00582 {}
00583
00589 static AIEventVehicleUnprofitable *Convert(AIEvent *instance) { return (AIEventVehicleUnprofitable *)instance; }
00590
00595 VehicleID GetVehicleID() { return this->vehicle_id; }
00596
00597 private:
00598 VehicleID vehicle_id;
00599 };
00600
00604 class AIEventIndustryOpen : public AIEvent {
00605 public:
00607 static const char *GetClassName() { return "AIEventIndustryOpen"; }
00608
00612 AIEventIndustryOpen(IndustryID industry_id) :
00613 AIEvent(AI_ET_INDUSTRY_OPEN),
00614 industry_id(industry_id)
00615 {}
00616
00622 static AIEventIndustryOpen *Convert(AIEvent *instance) { return (AIEventIndustryOpen *)instance; }
00623
00628 IndustryID GetIndustryID() { return this->industry_id; }
00629
00630 private:
00631 IndustryID industry_id;
00632 };
00633
00637 class AIEventIndustryClose : public AIEvent {
00638 public:
00640 static const char *GetClassName() { return "AIEventIndustryClose"; }
00641
00645 AIEventIndustryClose(IndustryID industry_id) :
00646 AIEvent(AI_ET_INDUSTRY_CLOSE),
00647 industry_id(industry_id)
00648 {}
00649
00655 static AIEventIndustryClose *Convert(AIEvent *instance) { return (AIEventIndustryClose *)instance; }
00656
00661 IndustryID GetIndustryID() { return this->industry_id; }
00662
00663 private:
00664 IndustryID industry_id;
00665 };
00666
00670 class AIEventEngineAvailable : public AIEvent {
00671 public:
00673 static const char *GetClassName() { return "AIEventEngineAvailable"; }
00674
00678 AIEventEngineAvailable(EngineID engine) :
00679 AIEvent(AI_ET_ENGINE_AVAILABLE),
00680 engine(engine)
00681 {}
00682
00688 static AIEventEngineAvailable *Convert(AIEvent *instance) { return (AIEventEngineAvailable *)instance; }
00689
00694 EngineID GetEngineID() { return this->engine; }
00695
00696 private:
00697 EngineID engine;
00698 };
00699
00703 class AIEventStationFirstVehicle : public AIEvent {
00704 public:
00706 static const char *GetClassName() { return "AIEventStationFirstVehicle"; }
00707
00712 AIEventStationFirstVehicle(StationID station, VehicleID vehicle) :
00713 AIEvent(AI_ET_STATION_FIRST_VEHICLE),
00714 station(station),
00715 vehicle(vehicle)
00716 {}
00717
00723 static AIEventStationFirstVehicle *Convert(AIEvent *instance) { return (AIEventStationFirstVehicle *)instance; }
00724
00729 StationID GetStationID() { return this->station; }
00730
00735 VehicleID GetVehicleID() { return this->vehicle; }
00736
00737 private:
00738 StationID station;
00739 VehicleID vehicle;
00740 };
00741
00745 class AIEventDisasterZeppelinerCrashed : public AIEvent {
00746 public:
00748 static const char *GetClassName() { return "AIEventDisasterZeppelinerCrashed"; }
00749
00753 AIEventDisasterZeppelinerCrashed(StationID station) :
00754 AIEvent(AI_ET_DISASTER_ZEPPELINER_CRASHED),
00755 station(station)
00756 {}
00757
00763 static AIEventDisasterZeppelinerCrashed *Convert(AIEvent *instance) { return (AIEventDisasterZeppelinerCrashed *)instance; }
00764
00769 StationID GetStationID() { return this->station; }
00770
00771 private:
00772 StationID station;
00773 };
00774
00778 class AIEventDisasterZeppelinerCleared : public AIEvent {
00779 public:
00781 static const char *GetClassName() { return "AIEventDisasterZeppelinerCleared"; }
00782
00786 AIEventDisasterZeppelinerCleared(StationID station) :
00787 AIEvent(AI_ET_DISASTER_ZEPPELINER_CLEARED),
00788 station(station)
00789 {}
00790
00796 static AIEventDisasterZeppelinerCleared *Convert(AIEvent *instance) { return (AIEventDisasterZeppelinerCleared *)instance; }
00797
00802 StationID GetStationID() { return this->station; }
00803
00804 private:
00805 StationID station;
00806 };
00807
00811 class AIEventTownFounded : public AIEvent {
00812 public:
00814 static const char *GetClassName() { return "AIEventTownFounded"; }
00815
00819 AIEventTownFounded(TownID town) :
00820 AIEvent(AI_ET_TOWN_FOUNDED),
00821 town(town)
00822 {}
00823
00829 static AIEventTownFounded *Convert(AIEvent *instance) { return (AIEventTownFounded *)instance; }
00830
00835 TownID GetTownID() { return this->town; }
00836
00837 private:
00838 TownID town;
00839 };
00840
00841 #endif