ai_event_types.hpp

Go to the documentation of this file.
00001 /* $Id: ai_event_types.hpp 21664 2010-12-29 23:44:39Z yexo $ */
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_object.hpp"
00016 #include "ai_event.hpp"
00017 #include "ai_company.hpp"
00018 
00023 class AIEventVehicleCrashed : public AIEvent {
00024 public:
00026   static const char *GetClassName() { return "AIEventVehicleCrashed"; }
00027 
00031   enum CrashReason {
00032     CRASH_TRAIN,                
00033     CRASH_RV_LEVEL_CROSSING,    
00034     CRASH_RV_UFO,               
00035     CRASH_PLANE_LANDING,        
00036     CRASH_AIRCRAFT_NO_AIRPORT,  
00037     CRASH_FLOODED,              
00038   };
00039 
00045   AIEventVehicleCrashed(VehicleID vehicle, TileIndex crash_site, CrashReason crash_reason) :
00046     AIEvent(AI_ET_VEHICLE_CRASHED),
00047     crash_site(crash_site),
00048     vehicle(vehicle),
00049     crash_reason(crash_reason)
00050   {}
00051 
00057   static AIEventVehicleCrashed *Convert(AIEvent *instance) { return (AIEventVehicleCrashed *)instance; }
00058 
00063   VehicleID GetVehicleID() { return this->vehicle; }
00064 
00069   TileIndex GetCrashSite() { return this->crash_site; }
00070 
00075   CrashReason GetCrashReason() { return this->crash_reason; }
00076 
00077 private:
00078   TileIndex crash_site;
00079   VehicleID vehicle;
00080   CrashReason crash_reason;
00081 };
00082 
00086 class AIEventSubsidyOffer : public AIEvent {
00087 public:
00089   static const char *GetClassName() { return "AIEventSubsidyOffer"; }
00090 
00094   AIEventSubsidyOffer(SubsidyID subsidy_id) :
00095     AIEvent(AI_ET_SUBSIDY_OFFER),
00096     subsidy_id(subsidy_id)
00097   {}
00098 
00104   static AIEventSubsidyOffer *Convert(AIEvent *instance) { return (AIEventSubsidyOffer *)instance; }
00105 
00110   SubsidyID GetSubsidyID() { return this->subsidy_id; }
00111 
00112 private:
00113   SubsidyID subsidy_id;
00114 };
00115 
00119 class AIEventSubsidyOfferExpired : public AIEvent {
00120 public:
00122   static const char *GetClassName() { return "AIEventSubsidyOfferExpired"; }
00123 
00127   AIEventSubsidyOfferExpired(SubsidyID subsidy_id) :
00128     AIEvent(AI_ET_SUBSIDY_OFFER_EXPIRED),
00129     subsidy_id(subsidy_id)
00130   {}
00131 
00137   static AIEventSubsidyOfferExpired *Convert(AIEvent *instance) { return (AIEventSubsidyOfferExpired *)instance; }
00138 
00143   SubsidyID GetSubsidyID() { return this->subsidy_id; }
00144 
00145 private:
00146   SubsidyID subsidy_id;
00147 };
00148 
00152 class AIEventSubsidyAwarded : public AIEvent {
00153 public:
00155   static const char *GetClassName() { return "AIEventSubsidyAwarded"; }
00156 
00160   AIEventSubsidyAwarded(SubsidyID subsidy_id) :
00161     AIEvent(AI_ET_SUBSIDY_AWARDED),
00162     subsidy_id(subsidy_id)
00163   {}
00164 
00170   static AIEventSubsidyAwarded *Convert(AIEvent *instance) { return (AIEventSubsidyAwarded *)instance; }
00171 
00176   SubsidyID GetSubsidyID() { return this->subsidy_id; }
00177 
00178 private:
00179   SubsidyID subsidy_id;
00180 };
00181 
00185 class AIEventSubsidyExpired : public AIEvent {
00186 public:
00188   static const char *GetClassName() { return "AIEventSubsidyExpired"; }
00189 
00193   AIEventSubsidyExpired(SubsidyID subsidy_id) :
00194     AIEvent(AI_ET_SUBSIDY_EXPIRED),
00195     subsidy_id(subsidy_id)
00196   {}
00197 
00203   static AIEventSubsidyExpired *Convert(AIEvent *instance) { return (AIEventSubsidyExpired *)instance; }
00204 
00209    SubsidyID GetSubsidyID() { return this->subsidy_id; }
00210 
00211 private:
00212   SubsidyID subsidy_id;
00213 };
00214 
00220 class AIEventEnginePreview : public AIEvent {
00221 public:
00223   static const char *GetClassName() { return "AIEventEnginePreview"; }
00224 
00228   AIEventEnginePreview(EngineID engine) :
00229     AIEvent(AI_ET_ENGINE_PREVIEW),
00230     engine(engine)
00231   {}
00232 
00238   static AIEventEnginePreview *Convert(AIEvent *instance) { return (AIEventEnginePreview *)instance; }
00239 
00244   char *GetName();
00245 
00251   CargoID GetCargoType();
00252 
00258   int32 GetCapacity();
00259 
00267   int32 GetMaxSpeed();
00268 
00273   Money GetPrice();
00274 
00280   Money GetRunningCost();
00281 
00282 #ifdef DOXYGEN_SKIP
00283 
00287   AIVehicle::VehicleType GetVehicleType();
00288 #else
00289   int32 GetVehicleType();
00290 #endif
00291 
00296   bool AcceptPreview();
00297 
00298 private:
00299   EngineID engine;
00300 };
00301 
00305 class AIEventCompanyNew : public AIEvent {
00306 public:
00308   static const char *GetClassName() { return "AIEventCompanyNew"; }
00309 
00313   AIEventCompanyNew(Owner owner) :
00314     AIEvent(AI_ET_COMPANY_NEW),
00315     owner((AICompany::CompanyID)owner)
00316   {}
00317 
00323   static AIEventCompanyNew *Convert(AIEvent *instance) { return (AIEventCompanyNew *)instance; }
00324 
00329   AICompany::CompanyID GetCompanyID() { return this->owner; }
00330 
00331 private:
00332   AICompany::CompanyID owner;
00333 };
00334 
00339 class AIEventCompanyInTrouble : public AIEvent {
00340 public:
00342   static const char *GetClassName() { return "AIEventCompanyInTrouble"; }
00343 
00347   AIEventCompanyInTrouble(Owner owner) :
00348     AIEvent(AI_ET_COMPANY_IN_TROUBLE),
00349     owner((AICompany::CompanyID)owner)
00350   {}
00351 
00357   static AIEventCompanyInTrouble *Convert(AIEvent *instance) { return (AIEventCompanyInTrouble *)instance; }
00358 
00363   AICompany::CompanyID GetCompanyID() { return this->owner; }
00364 
00365 private:
00366   AICompany::CompanyID owner;
00367 };
00368 
00372 class AIEventCompanyAskMerger : public AIEvent {
00373 public:
00375   static const char *GetClassName() { return "AIEventCompanyAskMerger"; }
00376 
00381   AIEventCompanyAskMerger(Owner owner, int32 value) :
00382     AIEvent(AI_ET_COMPANY_ASK_MERGER),
00383     owner((AICompany::CompanyID)owner),
00384     value(value)
00385   {}
00386 
00392   static AIEventCompanyAskMerger *Convert(AIEvent *instance) { return (AIEventCompanyAskMerger *)instance; }
00393 
00399   AICompany::CompanyID GetCompanyID() { return this->owner; }
00400 
00405   int32 GetValue() { return this->value; }
00406 
00411   bool AcceptMerger();
00412 
00413 private:
00414   AICompany::CompanyID owner;
00415   int32 value;
00416 };
00417 
00422 class AIEventCompanyMerger : public AIEvent {
00423 public:
00425   static const char *GetClassName() { return "AIEventCompanyMerger"; }
00426 
00431   AIEventCompanyMerger(Owner old_owner, Owner new_owner) :
00432     AIEvent(AI_ET_COMPANY_MERGER),
00433     old_owner((AICompany::CompanyID)old_owner),
00434     new_owner((AICompany::CompanyID)new_owner)
00435   {}
00436 
00442   static AIEventCompanyMerger *Convert(AIEvent *instance) { return (AIEventCompanyMerger *)instance; }
00443 
00451   AICompany::CompanyID GetOldCompanyID() { return this->old_owner; }
00452 
00457   AICompany::CompanyID GetNewCompanyID() { return this->new_owner; }
00458 
00459 private:
00460   AICompany::CompanyID old_owner;
00461   AICompany::CompanyID new_owner;
00462 };
00463 
00467 class AIEventCompanyBankrupt : public AIEvent {
00468 public:
00470   static const char *GetClassName() { return "AIEventCompanyBankrupt"; }
00471 
00475   AIEventCompanyBankrupt(Owner owner) :
00476     AIEvent(AI_ET_COMPANY_BANKRUPT),
00477     owner((AICompany::CompanyID)owner)
00478   {}
00479 
00485   static AIEventCompanyBankrupt *Convert(AIEvent *instance) { return (AIEventCompanyBankrupt *)instance; }
00486 
00491   AICompany::CompanyID GetCompanyID() { return this->owner; }
00492 
00493 private:
00494   AICompany::CompanyID owner;
00495 };
00496 
00500 class AIEventVehicleLost : public AIEvent {
00501 public:
00503   static const char *GetClassName() { return "AIEventVehicleLost"; }
00504 
00508   AIEventVehicleLost(VehicleID vehicle_id) :
00509     AIEvent(AI_ET_VEHICLE_LOST),
00510     vehicle_id(vehicle_id)
00511   {}
00512 
00518   static AIEventVehicleLost *Convert(AIEvent *instance) { return (AIEventVehicleLost *)instance; }
00519 
00524   VehicleID GetVehicleID() { return this->vehicle_id; }
00525 
00526 private:
00527   VehicleID vehicle_id;
00528 };
00529 
00533 class AIEventVehicleWaitingInDepot : public AIEvent {
00534 public:
00536   static const char *GetClassName() { return "AIEventVehicleWaitingInDepot"; }
00537 
00541   AIEventVehicleWaitingInDepot(VehicleID vehicle_id) :
00542     AIEvent(AI_ET_VEHICLE_WAITING_IN_DEPOT),
00543     vehicle_id(vehicle_id)
00544   {}
00545 
00551   static AIEventVehicleWaitingInDepot *Convert(AIEvent *instance) { return (AIEventVehicleWaitingInDepot *)instance; }
00552 
00557   VehicleID GetVehicleID() { return this->vehicle_id; }
00558 
00559 private:
00560   VehicleID vehicle_id;
00561 };
00562 
00566 class AIEventVehicleUnprofitable : public AIEvent {
00567 public:
00569   static const char *GetClassName() { return "AIEventVehicleUnprofitable"; }
00570 
00574   AIEventVehicleUnprofitable(VehicleID vehicle_id) :
00575     AIEvent(AI_ET_VEHICLE_UNPROFITABLE),
00576     vehicle_id(vehicle_id)
00577   {}
00578 
00584   static AIEventVehicleUnprofitable *Convert(AIEvent *instance) { return (AIEventVehicleUnprofitable *)instance; }
00585 
00590   VehicleID GetVehicleID() { return this->vehicle_id; }
00591 
00592 private:
00593   VehicleID vehicle_id;
00594 };
00595 
00599 class AIEventIndustryOpen : public AIEvent {
00600 public:
00602   static const char *GetClassName() { return "AIEventIndustryOpen"; }
00603 
00607   AIEventIndustryOpen(IndustryID industry_id) :
00608     AIEvent(AI_ET_INDUSTRY_OPEN),
00609     industry_id(industry_id)
00610   {}
00611 
00617   static AIEventIndustryOpen *Convert(AIEvent *instance) { return (AIEventIndustryOpen *)instance; }
00618 
00623   IndustryID GetIndustryID() { return this->industry_id; }
00624 
00625 private:
00626   IndustryID industry_id;
00627 };
00628 
00632 class AIEventIndustryClose : public AIEvent {
00633 public:
00635   static const char *GetClassName() { return "AIEventIndustryClose"; }
00636 
00640   AIEventIndustryClose(IndustryID industry_id) :
00641     AIEvent(AI_ET_INDUSTRY_CLOSE),
00642     industry_id(industry_id)
00643   {}
00644 
00650   static AIEventIndustryClose *Convert(AIEvent *instance) { return (AIEventIndustryClose *)instance; }
00651 
00656   IndustryID GetIndustryID() { return this->industry_id; }
00657 
00658 private:
00659   IndustryID industry_id;
00660 };
00661 
00665 class AIEventEngineAvailable : public AIEvent {
00666 public:
00668   static const char *GetClassName() { return "AIEventEngineAvailable"; }
00669 
00673   AIEventEngineAvailable(EngineID engine) :
00674     AIEvent(AI_ET_ENGINE_AVAILABLE),
00675     engine(engine)
00676   {}
00677 
00683   static AIEventEngineAvailable *Convert(AIEvent *instance) { return (AIEventEngineAvailable *)instance; }
00684 
00689   EngineID GetEngineID() { return this->engine; }
00690 
00691 private:
00692   EngineID engine;
00693 };
00694 
00698 class AIEventStationFirstVehicle : public AIEvent {
00699 public:
00701   static const char *GetClassName() { return "AIEventStationFirstVehicle"; }
00702 
00707   AIEventStationFirstVehicle(StationID station, VehicleID vehicle) :
00708     AIEvent(AI_ET_STATION_FIRST_VEHICLE),
00709     station(station),
00710     vehicle(vehicle)
00711   {}
00712 
00718   static AIEventStationFirstVehicle *Convert(AIEvent *instance) { return (AIEventStationFirstVehicle *)instance; }
00719 
00724   StationID GetStationID() { return this->station; }
00725 
00730   VehicleID GetVehicleID() { return this->vehicle; }
00731 
00732 private:
00733   StationID station;
00734   VehicleID vehicle;
00735 };
00736 
00740 class AIEventDisasterZeppelinerCrashed : public AIEvent {
00741 public:
00743   static const char *GetClassName() { return "AIEventDisasterZeppelinerCrashed"; }
00744 
00748   AIEventDisasterZeppelinerCrashed(StationID station) :
00749     AIEvent(AI_ET_DISASTER_ZEPPELINER_CRASHED),
00750     station(station)
00751   {}
00752 
00758   static AIEventDisasterZeppelinerCrashed *Convert(AIEvent *instance) { return (AIEventDisasterZeppelinerCrashed *)instance; }
00759 
00764   StationID GetStationID() { return this->station; }
00765 
00766 private:
00767   StationID station;
00768 };
00769 
00773 class AIEventDisasterZeppelinerCleared : public AIEvent {
00774 public:
00776   static const char *GetClassName() { return "AIEventDisasterZeppelinerCleared"; }
00777 
00781   AIEventDisasterZeppelinerCleared(StationID station) :
00782     AIEvent(AI_ET_DISASTER_ZEPPELINER_CLEARED),
00783     station(station)
00784   {}
00785 
00791   static AIEventDisasterZeppelinerCleared *Convert(AIEvent *instance) { return (AIEventDisasterZeppelinerCleared *)instance; }
00792 
00797   StationID GetStationID() { return this->station; }
00798 
00799 private:
00800   StationID station;
00801 };
00802 
00806 class AIEventTownFounded : public AIEvent {
00807 public:
00809   static const char *GetClassName() { return "AIEventTownFounded"; }
00810 
00814   AIEventTownFounded(TownID town) :
00815     AIEvent(AI_ET_TOWN_FOUNDED),
00816     town(town)
00817   {}
00818 
00824   static AIEventTownFounded *Convert(AIEvent *instance) { return (AIEventTownFounded *)instance; }
00825 
00830   TownID GetTownID() { return this->town; }
00831 
00832 private:
00833   TownID town;
00834 };
00835 
00836 #endif /* AI_EVENT_TYPES_HPP */

Generated on Sun Jan 9 16:01:51 2011 for OpenTTD by  doxygen 1.6.1