ai_event_types.hpp

Go to the documentation of this file.
00001 /* $Id: ai_event_types.hpp 21890 2011-01-22 14:52:20Z 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_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 
00281 #ifdef DOXYGEN_SKIP
00282 
00286   AIVehicle::VehicleType GetVehicleType();
00287 #else
00288   int32 GetVehicleType();
00289 #endif
00290 
00295   bool AcceptPreview();
00296 
00297 private:
00298   EngineID engine;
00299 };
00300 
00304 class AIEventCompanyNew : public AIEvent {
00305 public:
00307   static const char *GetClassName() { return "AIEventCompanyNew"; }
00308 
00312   AIEventCompanyNew(Owner owner) :
00313     AIEvent(AI_ET_COMPANY_NEW),
00314     owner((AICompany::CompanyID)owner)
00315   {}
00316 
00322   static AIEventCompanyNew *Convert(AIEvent *instance) { return (AIEventCompanyNew *)instance; }
00323 
00328   AICompany::CompanyID GetCompanyID() { return this->owner; }
00329 
00330 private:
00331   AICompany::CompanyID owner;
00332 };
00333 
00338 class AIEventCompanyInTrouble : public AIEvent {
00339 public:
00341   static const char *GetClassName() { return "AIEventCompanyInTrouble"; }
00342 
00346   AIEventCompanyInTrouble(Owner owner) :
00347     AIEvent(AI_ET_COMPANY_IN_TROUBLE),
00348     owner((AICompany::CompanyID)owner)
00349   {}
00350 
00356   static AIEventCompanyInTrouble *Convert(AIEvent *instance) { return (AIEventCompanyInTrouble *)instance; }
00357 
00362   AICompany::CompanyID GetCompanyID() { return this->owner; }
00363 
00364 private:
00365   AICompany::CompanyID owner;
00366 };
00367 
00371 class AIEventCompanyAskMerger : public AIEvent {
00372 public:
00374   static const char *GetClassName() { return "AIEventCompanyAskMerger"; }
00375 
00380   AIEventCompanyAskMerger(Owner owner, int32 value) :
00381     AIEvent(AI_ET_COMPANY_ASK_MERGER),
00382     owner((AICompany::CompanyID)owner),
00383     value(value)
00384   {}
00385 
00391   static AIEventCompanyAskMerger *Convert(AIEvent *instance) { return (AIEventCompanyAskMerger *)instance; }
00392 
00398   AICompany::CompanyID GetCompanyID() { return this->owner; }
00399 
00404   int32 GetValue() { return this->value; }
00405 
00410   bool AcceptMerger();
00411 
00412 private:
00413   AICompany::CompanyID owner;
00414   int32 value;
00415 };
00416 
00421 class AIEventCompanyMerger : public AIEvent {
00422 public:
00424   static const char *GetClassName() { return "AIEventCompanyMerger"; }
00425 
00430   AIEventCompanyMerger(Owner old_owner, Owner new_owner) :
00431     AIEvent(AI_ET_COMPANY_MERGER),
00432     old_owner((AICompany::CompanyID)old_owner),
00433     new_owner((AICompany::CompanyID)new_owner)
00434   {}
00435 
00441   static AIEventCompanyMerger *Convert(AIEvent *instance) { return (AIEventCompanyMerger *)instance; }
00442 
00450   AICompany::CompanyID GetOldCompanyID() { return this->old_owner; }
00451 
00456   AICompany::CompanyID GetNewCompanyID() { return this->new_owner; }
00457 
00458 private:
00459   AICompany::CompanyID old_owner;
00460   AICompany::CompanyID new_owner;
00461 };
00462 
00466 class AIEventCompanyBankrupt : public AIEvent {
00467 public:
00469   static const char *GetClassName() { return "AIEventCompanyBankrupt"; }
00470 
00474   AIEventCompanyBankrupt(Owner owner) :
00475     AIEvent(AI_ET_COMPANY_BANKRUPT),
00476     owner((AICompany::CompanyID)owner)
00477   {}
00478 
00484   static AIEventCompanyBankrupt *Convert(AIEvent *instance) { return (AIEventCompanyBankrupt *)instance; }
00485 
00490   AICompany::CompanyID GetCompanyID() { return this->owner; }
00491 
00492 private:
00493   AICompany::CompanyID owner;
00494 };
00495 
00499 class AIEventVehicleLost : public AIEvent {
00500 public:
00502   static const char *GetClassName() { return "AIEventVehicleLost"; }
00503 
00507   AIEventVehicleLost(VehicleID vehicle_id) :
00508     AIEvent(AI_ET_VEHICLE_LOST),
00509     vehicle_id(vehicle_id)
00510   {}
00511 
00517   static AIEventVehicleLost *Convert(AIEvent *instance) { return (AIEventVehicleLost *)instance; }
00518 
00523   VehicleID GetVehicleID() { return this->vehicle_id; }
00524 
00525 private:
00526   VehicleID vehicle_id;
00527 };
00528 
00532 class AIEventVehicleWaitingInDepot : public AIEvent {
00533 public:
00535   static const char *GetClassName() { return "AIEventVehicleWaitingInDepot"; }
00536 
00540   AIEventVehicleWaitingInDepot(VehicleID vehicle_id) :
00541     AIEvent(AI_ET_VEHICLE_WAITING_IN_DEPOT),
00542     vehicle_id(vehicle_id)
00543   {}
00544 
00550   static AIEventVehicleWaitingInDepot *Convert(AIEvent *instance) { return (AIEventVehicleWaitingInDepot *)instance; }
00551 
00556   VehicleID GetVehicleID() { return this->vehicle_id; }
00557 
00558 private:
00559   VehicleID vehicle_id;
00560 };
00561 
00565 class AIEventVehicleUnprofitable : public AIEvent {
00566 public:
00568   static const char *GetClassName() { return "AIEventVehicleUnprofitable"; }
00569 
00573   AIEventVehicleUnprofitable(VehicleID vehicle_id) :
00574     AIEvent(AI_ET_VEHICLE_UNPROFITABLE),
00575     vehicle_id(vehicle_id)
00576   {}
00577 
00583   static AIEventVehicleUnprofitable *Convert(AIEvent *instance) { return (AIEventVehicleUnprofitable *)instance; }
00584 
00589   VehicleID GetVehicleID() { return this->vehicle_id; }
00590 
00591 private:
00592   VehicleID vehicle_id;
00593 };
00594 
00598 class AIEventIndustryOpen : public AIEvent {
00599 public:
00601   static const char *GetClassName() { return "AIEventIndustryOpen"; }
00602 
00606   AIEventIndustryOpen(IndustryID industry_id) :
00607     AIEvent(AI_ET_INDUSTRY_OPEN),
00608     industry_id(industry_id)
00609   {}
00610 
00616   static AIEventIndustryOpen *Convert(AIEvent *instance) { return (AIEventIndustryOpen *)instance; }
00617 
00622   IndustryID GetIndustryID() { return this->industry_id; }
00623 
00624 private:
00625   IndustryID industry_id;
00626 };
00627 
00631 class AIEventIndustryClose : public AIEvent {
00632 public:
00634   static const char *GetClassName() { return "AIEventIndustryClose"; }
00635 
00639   AIEventIndustryClose(IndustryID industry_id) :
00640     AIEvent(AI_ET_INDUSTRY_CLOSE),
00641     industry_id(industry_id)
00642   {}
00643 
00649   static AIEventIndustryClose *Convert(AIEvent *instance) { return (AIEventIndustryClose *)instance; }
00650 
00655   IndustryID GetIndustryID() { return this->industry_id; }
00656 
00657 private:
00658   IndustryID industry_id;
00659 };
00660 
00664 class AIEventEngineAvailable : public AIEvent {
00665 public:
00667   static const char *GetClassName() { return "AIEventEngineAvailable"; }
00668 
00672   AIEventEngineAvailable(EngineID engine) :
00673     AIEvent(AI_ET_ENGINE_AVAILABLE),
00674     engine(engine)
00675   {}
00676 
00682   static AIEventEngineAvailable *Convert(AIEvent *instance) { return (AIEventEngineAvailable *)instance; }
00683 
00688   EngineID GetEngineID() { return this->engine; }
00689 
00690 private:
00691   EngineID engine;
00692 };
00693 
00697 class AIEventStationFirstVehicle : public AIEvent {
00698 public:
00700   static const char *GetClassName() { return "AIEventStationFirstVehicle"; }
00701 
00706   AIEventStationFirstVehicle(StationID station, VehicleID vehicle) :
00707     AIEvent(AI_ET_STATION_FIRST_VEHICLE),
00708     station(station),
00709     vehicle(vehicle)
00710   {}
00711 
00717   static AIEventStationFirstVehicle *Convert(AIEvent *instance) { return (AIEventStationFirstVehicle *)instance; }
00718 
00723   StationID GetStationID() { return this->station; }
00724 
00729   VehicleID GetVehicleID() { return this->vehicle; }
00730 
00731 private:
00732   StationID station;
00733   VehicleID vehicle;
00734 };
00735 
00739 class AIEventDisasterZeppelinerCrashed : public AIEvent {
00740 public:
00742   static const char *GetClassName() { return "AIEventDisasterZeppelinerCrashed"; }
00743 
00747   AIEventDisasterZeppelinerCrashed(StationID station) :
00748     AIEvent(AI_ET_DISASTER_ZEPPELINER_CRASHED),
00749     station(station)
00750   {}
00751 
00757   static AIEventDisasterZeppelinerCrashed *Convert(AIEvent *instance) { return (AIEventDisasterZeppelinerCrashed *)instance; }
00758 
00763   StationID GetStationID() { return this->station; }
00764 
00765 private:
00766   StationID station;
00767 };
00768 
00772 class AIEventDisasterZeppelinerCleared : public AIEvent {
00773 public:
00775   static const char *GetClassName() { return "AIEventDisasterZeppelinerCleared"; }
00776 
00780   AIEventDisasterZeppelinerCleared(StationID station) :
00781     AIEvent(AI_ET_DISASTER_ZEPPELINER_CLEARED),
00782     station(station)
00783   {}
00784 
00790   static AIEventDisasterZeppelinerCleared *Convert(AIEvent *instance) { return (AIEventDisasterZeppelinerCleared *)instance; }
00791 
00796   StationID GetStationID() { return this->station; }
00797 
00798 private:
00799   StationID station;
00800 };
00801 
00805 class AIEventTownFounded : public AIEvent {
00806 public:
00808   static const char *GetClassName() { return "AIEventTownFounded"; }
00809 
00813   AIEventTownFounded(TownID town) :
00814     AIEvent(AI_ET_TOWN_FOUNDED),
00815     town(town)
00816   {}
00817 
00823   static AIEventTownFounded *Convert(AIEvent *instance) { return (AIEventTownFounded *)instance; }
00824 
00829   TownID GetTownID() { return this->town; }
00830 
00831 private:
00832   TownID town;
00833 };
00834 
00835 #endif /* AI_EVENT_TYPES_HPP */

Generated on Fri Feb 4 20:53:37 2011 for OpenTTD by  doxygen 1.6.1