~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/ai/api/ai_event_types.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman, Jordi Mallach
  • Date: 2009-04-15 18:22:10 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090415182210-22ktb8kdbp2tf3bm
[ Matthijs Kooijman ]
* New upstream release.
* Remove Debian specific desktop file, upstream provides one now. 
* Add debian/watch file.

[ Jordi Mallach ]
* Bump Standards-Version to 3.8.1, with no changes required.
* Move to debhelper compat 7. Bump Build-Depends accordingly.
* Use dh_prep.
* Add "set -e" to config script.
* Remove a few extra doc files that get installed by upstream Makefile.
* Add more complete copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: ai_event_types.hpp 15520 2009-02-19 09:01:34Z yexo $ */
 
2
 
 
3
/** @file ai_event_types.hpp The detailed types of all events. */
 
4
 
 
5
#ifndef AI_EVENT_TYPES_HPP
 
6
#define AI_EVENT_TYPES_HPP
 
7
 
 
8
#include "ai_object.hpp"
 
9
#include "ai_event.hpp"
 
10
#include "ai_town.hpp"
 
11
#include "ai_industry.hpp"
 
12
#include "ai_engine.hpp"
 
13
#include "ai_subsidy.hpp"
 
14
 
 
15
/**
 
16
 * Event Vehicle Crash, indicating a vehicle of yours is crashed.
 
17
 *  It contains the crash site, the crashed vehicle and the reason for the crash.
 
18
 */
 
19
class AIEventVehicleCrashed : public AIEvent {
 
20
public:
 
21
        static const char *GetClassName() { return "AIEventVehicleCrashed"; }
 
22
 
 
23
        /**
 
24
         * The reasons for vehicle crashes
 
25
         */
 
26
        enum CrashReason {
 
27
                CRASH_TRAIN,                //!< Two trains collided
 
28
                CRASH_RV_LEVEL_CROSSING,    //!< Road vehicle got under a train
 
29
                CRASH_RV_UFO,               //!< Road vehicle got under a landing ufo
 
30
                CRASH_PLANE_LANDING,        //!< Plane crashed on landing
 
31
                CRASH_AIRCRAFT_NO_AIRPORT,  //!< Aircraft crashed after it found not a single airport for landing
 
32
                CRASH_FLOODED,              //!< Vehicle was flooded
 
33
        };
 
34
 
 
35
        /**
 
36
         * @param vehicle The vehicle that crashed.
 
37
         * @param crash_site Where the vehicle crashed.
 
38
         */
 
39
        AIEventVehicleCrashed(VehicleID vehicle, TileIndex crash_site, CrashReason crash_reason) :
 
40
                AIEvent(AI_ET_VEHICLE_CRASHED),
 
41
                crash_site(crash_site),
 
42
                vehicle(vehicle),
 
43
                crash_reason(crash_reason)
 
44
        {}
 
45
 
 
46
        /**
 
47
         * Convert an AIEvent to the real instance.
 
48
         * @param instance The instance to convert.
 
49
         * @return The converted instance.
 
50
         */
 
51
        static AIEventVehicleCrashed *Convert(AIEvent *instance) { return (AIEventVehicleCrashed *)instance; }
 
52
 
 
53
        /**
 
54
         * Get the VehicleID of the crashed vehicle.
 
55
         * @return The crashed vehicle.
 
56
         */
 
57
        VehicleID GetVehicleID() { return vehicle; }
 
58
 
 
59
        /**
 
60
         * Find the tile the vehicle crashed.
 
61
         * @return The crash site.
 
62
         */
 
63
        TileIndex GetCrashSite() { return crash_site; }
 
64
 
 
65
        /**
 
66
         * Get the reason for crashing
 
67
         * @return The reason for crashing
 
68
         */
 
69
        CrashReason GetCrashReason() { return crash_reason; }
 
70
 
 
71
private:
 
72
        TileIndex crash_site;
 
73
        VehicleID vehicle;
 
74
        CrashReason crash_reason;
 
75
};
 
76
 
 
77
/**
 
78
 * Event Subsidy Offered, indicating someone offered a subsidy.
 
79
 */
 
80
class AIEventSubsidyOffer : public AIEvent {
 
81
public:
 
82
        static const char *GetClassName() { return "AIEventSubsidyOffer"; }
 
83
 
 
84
        /**
 
85
         * @param subsidy_id The index of this subsidy in the _subsidies array.
 
86
         */
 
87
        AIEventSubsidyOffer(SubsidyID subsidy_id) :
 
88
                AIEvent(AI_ET_SUBSIDY_OFFER),
 
89
                subsidy_id(subsidy_id)
 
90
        {}
 
91
 
 
92
        /**
 
93
         * Convert an AIEvent to the real instance.
 
94
         * @param instance The instance to convert.
 
95
         * @return The converted instance.
 
96
         */
 
97
        static AIEventSubsidyOffer *Convert(AIEvent *instance) { return (AIEventSubsidyOffer *)instance; }
 
98
 
 
99
        /**
 
100
         * Get the SubsidyID of the subsidy.
 
101
         * @return The subsidy id.
 
102
         */
 
103
        SubsidyID GetSubsidyID() { return subsidy_id; }
 
104
 
 
105
private:
 
106
        SubsidyID subsidy_id;
 
107
};
 
108
 
 
109
/**
 
110
 * Event Subsidy Offer Expired, indicating a subsidy will no longer be awarded.
 
111
 */
 
112
class AIEventSubsidyOfferExpired : public AIEvent {
 
113
public:
 
114
        static const char *GetClassName() { return "AIEventSubsidyOfferExpired"; }
 
115
 
 
116
        /**
 
117
         * @param subsidy_id The index of this subsidy in the _subsidies array.
 
118
         */
 
119
        AIEventSubsidyOfferExpired(SubsidyID subsidy_id) :
 
120
                AIEvent(AI_ET_SUBSIDY_OFFER_EXPIRED),
 
121
                subsidy_id(subsidy_id)
 
122
        {}
 
123
 
 
124
        /**
 
125
         * Convert an AIEvent to the real instance.
 
126
         * @param instance The instance to convert.
 
127
         * @return The converted instance.
 
128
         */
 
129
        static AIEventSubsidyOfferExpired *Convert(AIEvent *instance) { return (AIEventSubsidyOfferExpired *)instance; }
 
130
 
 
131
        /**
 
132
         * Get the SubsidyID of the subsidy.
 
133
         * @return The subsidy id.
 
134
         */
 
135
        SubsidyID GetSubsidyID() { return subsidy_id; }
 
136
 
 
137
private:
 
138
        SubsidyID subsidy_id;
 
139
};
 
140
 
 
141
/**
 
142
 * Event Subidy Awarded, indicating a subsidy is awarded to some company.
 
143
 */
 
144
class AIEventSubsidyAwarded : public AIEvent {
 
145
public:
 
146
        static const char *GetClassName() { return "AIEventSubsidyAwarded"; }
 
147
 
 
148
        /**
 
149
         * @param subsidy_id The index of this subsidy in the _subsidies array.
 
150
         */
 
151
        AIEventSubsidyAwarded(SubsidyID subsidy_id) :
 
152
                AIEvent(AI_ET_SUBSIDY_AWARDED),
 
153
                subsidy_id(subsidy_id)
 
154
        {}
 
155
 
 
156
        /**
 
157
         * Convert an AIEvent to the real instance.
 
158
         * @param instance The instance to convert.
 
159
         * @return The converted instance.
 
160
         */
 
161
        static AIEventSubsidyAwarded *Convert(AIEvent *instance) { return (AIEventSubsidyAwarded *)instance; }
 
162
 
 
163
        /**
 
164
         * Get the SubsidyID of the subsidy.
 
165
         * @return The subsidy id.
 
166
         */
 
167
        SubsidyID GetSubsidyID() { return subsidy_id; }
 
168
 
 
169
private:
 
170
        SubsidyID subsidy_id;
 
171
};
 
172
 
 
173
/**
 
174
 * Event Subsidy Expired, indicating a route that was once subsidized no longer is.
 
175
 */
 
176
class AIEventSubsidyExpired : public AIEvent {
 
177
public:
 
178
        static const char *GetClassName() { return "AIEventSubsidyExpired"; }
 
179
 
 
180
        /**
 
181
         * @param subsidy_id The index of this subsidy in the _subsidies array.
 
182
         */
 
183
        AIEventSubsidyExpired(SubsidyID subsidy_id) :
 
184
                AIEvent(AI_ET_SUBSIDY_EXPIRED),
 
185
                subsidy_id(subsidy_id)
 
186
        {}
 
187
 
 
188
        /**
 
189
         * Convert an AIEvent to the real instance.
 
190
         * @param instance The instance to convert.
 
191
         * @return The converted instance.
 
192
         */
 
193
        static AIEventSubsidyExpired *Convert(AIEvent *instance) { return (AIEventSubsidyExpired *)instance; }
 
194
 
 
195
        /**
 
196
         * Get the SubsidyID of the subsidy.
 
197
         * @return The subsidy id.
 
198
         */
 
199
         SubsidyID GetSubsidyID() { return subsidy_id; }
 
200
 
 
201
private:
 
202
        SubsidyID subsidy_id;
 
203
};
 
204
 
 
205
/**
 
206
 * Event Engine Preview, indicating a manufacturer offer you to test a new engine.
 
207
 *  You can get the same information about the offered engine as a real user
 
208
 *  would see in the offer window. And you can also accept the offer.
 
209
 */
 
210
class AIEventEnginePreview : public AIEvent {
 
211
public:
 
212
        static const char *GetClassName() { return "AIEventEnginePreview"; }
 
213
 
 
214
        /**
 
215
         * @param engine The engine offered to test.
 
216
         */
 
217
        AIEventEnginePreview(EngineID engine) :
 
218
                AIEvent(AI_ET_ENGINE_PREVIEW),
 
219
                engine(engine)
 
220
        {}
 
221
 
 
222
        /**
 
223
         * Convert an AIEvent to the real instance.
 
224
         * @param instance The instance to convert.
 
225
         * @return The converted instance.
 
226
         */
 
227
        static AIEventEnginePreview *Convert(AIEvent *instance) { return (AIEventEnginePreview *)instance; }
 
228
 
 
229
        /**
 
230
         * Get the name of the offered engine.
 
231
         * @return The name the engine has.
 
232
         */
 
233
        char *GetName();
 
234
 
 
235
        /**
 
236
         * Get the cargo-type of the offered engine. In case it can transport 2 cargos, it
 
237
         *  returns the first.
 
238
         * @return The cargo-type of the engine.
 
239
         */
 
240
        CargoID GetCargoType();
 
241
 
 
242
        /**
 
243
         * Get the capacity of the offered engine. In case it can transport 2 cargos, it
 
244
         *  returns the first.
 
245
         * @return The capacity of the engine.
 
246
         */
 
247
        int32 GetCapacity();
 
248
 
 
249
        /**
 
250
         * Get the maximum speed of the offered engine.
 
251
         * @return The maximum speed the engine has.
 
252
         * @note The speed is in OpenTTD's internal speed unit.
 
253
         *       This is mph / 1.6, which is roughly km/h.
 
254
         *       To get km/h multiply this number by 1.00584.
 
255
         */
 
256
        int32 GetMaxSpeed();
 
257
 
 
258
        /**
 
259
         * Get the new cost of the offered engine.
 
260
         * @return The new cost the engine has.
 
261
         */
 
262
        Money GetPrice();
 
263
 
 
264
        /**
 
265
         * Get the running cost of the offered engine.
 
266
         * @return The running cost of the vehicle per year.
 
267
         * @note Cost is per year; divide by 365 to get per day.
 
268
         */
 
269
        Money GetRunningCost();
 
270
 
 
271
        /**
 
272
         * Get the type of the offered engine.
 
273
         * @return The type the engine has.
 
274
         */
 
275
        AIVehicle::VehicleType GetVehicleType();
 
276
 
 
277
        /**
 
278
         * Accept the engine preview.
 
279
         * @return True when the accepting succeeded.
 
280
         */
 
281
        bool AcceptPreview();
 
282
 
 
283
private:
 
284
        EngineID engine;
 
285
};
 
286
 
 
287
/**
 
288
 * Event Company New, indicating a new company has been created.
 
289
 */
 
290
class AIEventCompanyNew : public AIEvent {
 
291
public:
 
292
        static const char *GetClassName() { return "AIEventCompanyNew"; }
 
293
 
 
294
        /**
 
295
         * @param owner The new company.
 
296
         */
 
297
        AIEventCompanyNew(Owner owner) :
 
298
                AIEvent(AI_ET_COMPANY_NEW),
 
299
                owner((AICompany::CompanyID)(byte)owner)
 
300
        {}
 
301
 
 
302
        /**
 
303
         * Convert an AIEvent to the real instance.
 
304
         * @param instance The instance to convert.
 
305
         * @return The converted instance.
 
306
         */
 
307
        static AIEventCompanyNew *Convert(AIEvent *instance) { return (AIEventCompanyNew *)instance; }
 
308
 
 
309
        /**
 
310
         * Get the CompanyID of the company that has been created.
 
311
         * @return The CompanyID of the company.
 
312
         */
 
313
        AICompany::CompanyID GetCompanyID() { return owner; }
 
314
 
 
315
private:
 
316
        AICompany::CompanyID owner;
 
317
};
 
318
 
 
319
/**
 
320
 * Event Company In Trouble, indicating a company is in trouble and might go
 
321
 *  bankrupt soon.
 
322
 */
 
323
class AIEventCompanyInTrouble : public AIEvent {
 
324
public:
 
325
        static const char *GetClassName() { return "AIEventCompanyInTrouble"; }
 
326
 
 
327
        /**
 
328
         * @param owner The company that is in trouble.
 
329
         */
 
330
        AIEventCompanyInTrouble(Owner owner) :
 
331
                AIEvent(AI_ET_COMPANY_IN_TROUBLE),
 
332
                owner((AICompany::CompanyID)(byte)owner)
 
333
        {}
 
334
 
 
335
        /**
 
336
         * Convert an AIEvent to the real instance.
 
337
         * @param instance The instance to convert.
 
338
         * @return The converted instance.
 
339
         */
 
340
        static AIEventCompanyInTrouble *Convert(AIEvent *instance) { return (AIEventCompanyInTrouble *)instance; }
 
341
 
 
342
        /**
 
343
         * Get the CompanyID of the company that is in trouble.
 
344
         * @return The CompanyID of the company in trouble.
 
345
         */
 
346
        AICompany::CompanyID GetCompanyID() { return owner; }
 
347
 
 
348
private:
 
349
        AICompany::CompanyID owner;
 
350
};
 
351
 
 
352
/**
 
353
 * Event Company Merger, indicating a company has been bought by another
 
354
 *  company.
 
355
 */
 
356
class AIEventCompanyMerger : public AIEvent {
 
357
public:
 
358
        static const char *GetClassName() { return "AIEventCompanyMerger"; }
 
359
 
 
360
        /**
 
361
         * @param old_owner The company bought off.
 
362
         * @param new_owner The company that bougth owner.
 
363
         */
 
364
        AIEventCompanyMerger(Owner old_owner, Owner new_owner) :
 
365
                AIEvent(AI_ET_COMPANY_MERGER),
 
366
                old_owner((AICompany::CompanyID)(byte)old_owner),
 
367
                new_owner((AICompany::CompanyID)(byte)new_owner)
 
368
        {}
 
369
 
 
370
        /**
 
371
         * Convert an AIEvent to the real instance.
 
372
         * @param instance The instance to convert.
 
373
         * @return The converted instance.
 
374
         */
 
375
        static AIEventCompanyMerger *Convert(AIEvent *instance) { return (AIEventCompanyMerger *)instance; }
 
376
 
 
377
        /**
 
378
         * Get the CompanyID of the company that has been bought.
 
379
         * @return The CompanyID of the company that has been bought.
 
380
         * @note: The value below is not valid anymore as CompanyID, and
 
381
         *  AICompany::ResolveCompanyID will return COMPANY_COMPANY. It's
 
382
         *  only usefull if you're keeping track of company's yourself.
 
383
         */
 
384
        AICompany::CompanyID GetOldCompanyID() { return old_owner; }
 
385
 
 
386
        /**
 
387
         * Get the CompanyID of the new owner.
 
388
         * @return The CompanyID of the new owner.
 
389
         */
 
390
        AICompany::CompanyID GetNewCompanyID() { return new_owner; }
 
391
 
 
392
private:
 
393
        AICompany::CompanyID old_owner;
 
394
        AICompany::CompanyID new_owner;
 
395
};
 
396
 
 
397
/**
 
398
 * Event Company Bankrupt, indicating a company has gone bankrupt.
 
399
 */
 
400
class AIEventCompanyBankrupt : public AIEvent {
 
401
public:
 
402
        static const char *GetClassName() { return "AIEventCompanyBankrupt"; }
 
403
 
 
404
        /**
 
405
         * @param owner The company that has gone bankrupt.
 
406
         */
 
407
        AIEventCompanyBankrupt(Owner owner) :
 
408
                AIEvent(AI_ET_COMPANY_BANKRUPT),
 
409
                owner((AICompany::CompanyID)(byte)owner)
 
410
        {}
 
411
 
 
412
        /**
 
413
         * Convert an AIEvent to the real instance.
 
414
         * @param instance The instance to convert.
 
415
         * @return The converted instance.
 
416
         */
 
417
        static AIEventCompanyBankrupt *Convert(AIEvent *instance) { return (AIEventCompanyBankrupt *)instance; }
 
418
 
 
419
        /**
 
420
         * Get the CompanyID of the company that has gone bankrupt.
 
421
         * @return The CompanyID of the company that has gone bankrupt.
 
422
         */
 
423
        AICompany::CompanyID GetCompanyID() { return owner; }
 
424
 
 
425
private:
 
426
        AICompany::CompanyID owner;
 
427
};
 
428
 
 
429
/**
 
430
 * Event Vehicle Lost, indicating a vehicle can't find its way to its destination.
 
431
 */
 
432
class AIEventVehicleLost : public AIEvent {
 
433
public:
 
434
        static const char *GetClassName() { return "AIEventVehicleLost"; }
 
435
 
 
436
        /**
 
437
         * @param vehicle_id The vehicle that is lost.
 
438
         */
 
439
        AIEventVehicleLost(VehicleID vehicle_id) :
 
440
                AIEvent(AI_ET_VEHICLE_LOST),
 
441
                vehicle_id(vehicle_id)
 
442
        {}
 
443
 
 
444
        /**
 
445
         * Convert an AIEvent to the real instance.
 
446
         * @param instance The instance to convert.
 
447
         * @return The converted instance.
 
448
         */
 
449
        static AIEventVehicleLost *Convert(AIEvent *instance) { return (AIEventVehicleLost *)instance; }
 
450
 
 
451
        /**
 
452
         * Get the VehicleID of the vehicle that is lost.
 
453
         * @return The VehicleID of the vehicle that is lost.
 
454
         */
 
455
        VehicleID GetVehicleID() { return vehicle_id; }
 
456
 
 
457
private:
 
458
        VehicleID vehicle_id;
 
459
};
 
460
 
 
461
/**
 
462
 * Event VehicleWaitingInDepot, indicating a vehicle has arrived a depot and is now waiting there.
 
463
 */
 
464
class AIEventVehicleWaitingInDepot : public AIEvent {
 
465
public:
 
466
        static const char *GetClassName() { return "AIEventVehicleWaitingInDepot"; }
 
467
 
 
468
        /**
 
469
         * @param vehicle_id The vehicle that is waiting in a depot.
 
470
         */
 
471
        AIEventVehicleWaitingInDepot(VehicleID vehicle_id) :
 
472
                AIEvent(AI_ET_VEHICLE_WAITING_IN_DEPOT),
 
473
                vehicle_id(vehicle_id)
 
474
        {}
 
475
 
 
476
        /**
 
477
         * Convert an AIEvent to the real instance.
 
478
         * @param instance The instance to convert.
 
479
         * @return The converted instance.
 
480
         */
 
481
        static AIEventVehicleWaitingInDepot *Convert(AIEvent *instance) { return (AIEventVehicleWaitingInDepot *)instance; }
 
482
 
 
483
        /**
 
484
         * Get the VehicleID of the vehicle that is waiting in a depot.
 
485
         * @return The VehicleID of the vehicle that is waiting in a depot.
 
486
         */
 
487
        VehicleID GetVehicleID() { return vehicle_id; }
 
488
 
 
489
private:
 
490
        VehicleID vehicle_id;
 
491
};
 
492
 
 
493
/**
 
494
 * Event Vehicle Unprofitable, indicating a vehicle lost money last year.
 
495
 */
 
496
class AIEventVehicleUnprofitable : public AIEvent {
 
497
public:
 
498
        static const char *GetClassName() { return "AIEventVehicleUnprofitable"; }
 
499
 
 
500
        /**
 
501
         * @param vehicle_id The vehicle that was unprofitable.
 
502
         */
 
503
        AIEventVehicleUnprofitable(VehicleID vehicle_id) :
 
504
                AIEvent(AI_ET_VEHICLE_UNPROFITABLE),
 
505
                vehicle_id(vehicle_id)
 
506
        {}
 
507
 
 
508
        /**
 
509
         * Convert an AIEvent to the real instance.
 
510
         * @param instance The instance to convert.
 
511
         * @return The converted instance.
 
512
         */
 
513
        static AIEventVehicleUnprofitable *Convert(AIEvent *instance) { return (AIEventVehicleUnprofitable *)instance; }
 
514
 
 
515
        /**
 
516
         * Get the VehicleID of the vehicle that lost money.
 
517
         * @return The VehicleID of the vehicle that lost money.
 
518
         */
 
519
        VehicleID GetVehicleID() { return vehicle_id; }
 
520
 
 
521
private:
 
522
        VehicleID vehicle_id;
 
523
};
 
524
 
 
525
/**
 
526
 * Event Industry Open, indicating a new industry has been created.
 
527
 */
 
528
class AIEventIndustryOpen : public AIEvent {
 
529
public:
 
530
        static const char *GetClassName() { return "AIEventIndustryOpen"; }
 
531
 
 
532
        /**
 
533
         * @param industry_id The new industry.
 
534
         */
 
535
        AIEventIndustryOpen(IndustryID industry_id) :
 
536
                AIEvent(AI_ET_INDUSTRY_OPEN),
 
537
                industry_id(industry_id)
 
538
        {}
 
539
 
 
540
        /**
 
541
         * Convert an AIEvent to the real instance.
 
542
         * @param instance The instance to convert.
 
543
         * @return The converted instance.
 
544
         */
 
545
        static AIEventIndustryOpen *Convert(AIEvent *instance) { return (AIEventIndustryOpen *)instance; }
 
546
 
 
547
        /**
 
548
         * Get the IndustryID of the new industry.
 
549
         * @return The IndustryID of the industry.
 
550
         */
 
551
        IndustryID GetIndustryID() { return industry_id; }
 
552
 
 
553
private:
 
554
        IndustryID industry_id;
 
555
};
 
556
 
 
557
/**
 
558
 * Event Industry Close, indicating an industry is going to be closed.
 
559
 */
 
560
class AIEventIndustryClose : public AIEvent {
 
561
public:
 
562
        static const char *GetClassName() { return "AIEventIndustryClose"; }
 
563
 
 
564
        /**
 
565
         * @param industry_id The new industry.
 
566
         */
 
567
        AIEventIndustryClose(IndustryID industry_id) :
 
568
                AIEvent(AI_ET_INDUSTRY_CLOSE),
 
569
                industry_id(industry_id)
 
570
        {}
 
571
 
 
572
        /**
 
573
         * Convert an AIEvent to the real instance.
 
574
         * @param instance The instance to convert.
 
575
         * @return The converted instance.
 
576
         */
 
577
        static AIEventIndustryClose *Convert(AIEvent *instance) { return (AIEventIndustryClose *)instance; }
 
578
 
 
579
        /**
 
580
         * Get the IndustryID of the closing industry.
 
581
         * @return The IndustryID of the industry.
 
582
         */
 
583
        IndustryID GetIndustryID() { return industry_id; }
 
584
 
 
585
private:
 
586
        IndustryID industry_id;
 
587
};
 
588
 
 
589
/**
 
590
 * Event Engine Available, indicating a new engine is available.
 
591
 */
 
592
class AIEventEngineAvailable : public AIEvent {
 
593
public:
 
594
        static const char *GetClassName() { return "AIEventEngineAvailable"; }
 
595
 
 
596
        /**
 
597
         * @param engine The engine that is available.
 
598
         */
 
599
        AIEventEngineAvailable(EngineID engine) :
 
600
                AIEvent(AI_ET_ENGINE_AVAILABLE),
 
601
                engine(engine)
 
602
        {}
 
603
 
 
604
        /**
 
605
         * Convert an AIEvent to the real instance.
 
606
         * @param instance The instance to convert.
 
607
         * @return The converted instance.
 
608
         */
 
609
        static AIEventEngineAvailable *Convert(AIEvent *instance) { return (AIEventEngineAvailable *)instance; }
 
610
 
 
611
        /**
 
612
         * Get the EngineID of the new engine.
 
613
         * @return The EngineID of the new engine.
 
614
         */
 
615
        EngineID GetEngineID() { return engine; }
 
616
 
 
617
private:
 
618
        EngineID engine;
 
619
};
 
620
 
 
621
/**
 
622
 * Event Station First Vehicle, indicating a station has been visited by a vehicle for the first time.
 
623
 */
 
624
class AIEventStationFirstVehicle : public AIEvent {
 
625
public:
 
626
        static const char *GetClassName() { return "AIEventStationFirstVehicle"; }
 
627
 
 
628
        /**
 
629
         * @param station The station visited for the first time.
 
630
         * @param vehicle The vehicle visiting the station.
 
631
         */
 
632
        AIEventStationFirstVehicle(StationID station, VehicleID vehicle) :
 
633
                AIEvent(AI_ET_STATION_FIRST_VEHICLE),
 
634
                station(station),
 
635
                vehicle(vehicle)
 
636
        {}
 
637
 
 
638
        /**
 
639
         * Convert an AIEvent to the real instance.
 
640
         * @param instance The instance to convert.
 
641
         * @return The converted instance.
 
642
         */
 
643
        static AIEventStationFirstVehicle *Convert(AIEvent *instance) { return (AIEventStationFirstVehicle *)instance; }
 
644
 
 
645
        /**
 
646
         * Get the StationID of the visited station.
 
647
         * @return The StationID of the visited station.
 
648
         */
 
649
        StationID GetStationID() { return station; }
 
650
 
 
651
        /**
 
652
         * Get the VehicleID of the first vehicle.
 
653
         * @return The VehicleID of the first vehicle.
 
654
         */
 
655
        VehicleID GetVehicleID() { return vehicle; }
 
656
 
 
657
private:
 
658
        StationID station;
 
659
        VehicleID vehicle;
 
660
};
 
661
 
 
662
/**
 
663
 * Event Disaster Zeppeliner Crashed, indicating a zeppeliner has crashed on an airport and is blocking the runway.
 
664
 */
 
665
class AIEventDisasterZeppelinerCrashed : public AIEvent {
 
666
public:
 
667
        static const char *GetClassName() { return "AIEventDisasterZeppelinerCrashed"; }
 
668
 
 
669
        /**
 
670
         * @param station The station containing the affected airport
 
671
         */
 
672
        AIEventDisasterZeppelinerCrashed(StationID station) :
 
673
                AIEvent(AI_ET_DISASTER_ZEPPELINER_CRASHED),
 
674
                station(station)
 
675
        {}
 
676
 
 
677
        /**
 
678
         * Convert an AIEvent to the real instance.
 
679
         * @param instance The instance to convert.
 
680
         * @return The converted instance.
 
681
         */
 
682
        static AIEventDisasterZeppelinerCrashed *Convert(AIEvent *instance) { return (AIEventDisasterZeppelinerCrashed *)instance; }
 
683
 
 
684
        /**
 
685
         * Get the StationID of the station containing the affected airport.
 
686
         * @return The StationID of the station containing the affected airport.
 
687
         */
 
688
        StationID GetStationID() { return station; }
 
689
 
 
690
private:
 
691
        StationID station;
 
692
};
 
693
 
 
694
/**
 
695
 * Event Disaster Zeppeliner Cleared, indicating a previously crashed zeppeliner has been removed, and the airport is operating again.
 
696
 */
 
697
class AIEventDisasterZeppelinerCleared : public AIEvent {
 
698
public:
 
699
        static const char *GetClassName() { return "AIEventDisasterZeppelinerCleared"; }
 
700
 
 
701
        /**
 
702
         * @param station The station containing the affected airport
 
703
         */
 
704
        AIEventDisasterZeppelinerCleared(StationID station) :
 
705
                AIEvent(AI_ET_DISASTER_ZEPPELINER_CLEARED),
 
706
                station(station)
 
707
        {}
 
708
 
 
709
        /**
 
710
         * Convert an AIEvent to the real instance.
 
711
         * @param instance The instance to convert.
 
712
         * @return The converted instance.
 
713
         */
 
714
        static AIEventDisasterZeppelinerCleared *Convert(AIEvent *instance) { return (AIEventDisasterZeppelinerCleared *)instance; }
 
715
 
 
716
        /**
 
717
         * Get the StationID of the station containing the affected airport.
 
718
         * @return The StationID of the station containing the affected airport.
 
719
         */
 
720
        StationID GetStationID() { return station; }
 
721
 
 
722
private:
 
723
        StationID station;
 
724
};
 
725
 
 
726
#endif /* AI_EVENT_TYPES_HPP */