author | truebrain |
Wed, 26 Mar 2008 15:17:40 +0000 | |
branch | noai |
changeset 9823 | 0b7f816cf46f |
parent 9683 | a4683b021073 |
child 9829 | 80fbe02a4184 |
permissions | -rw-r--r-- |
9682
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
1 |
/* $Id$ */ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
2 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
3 |
/** @file ai_event.hpp Everything to handle events from the game */ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
4 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
5 |
#ifndef AI_EVENT_HPP |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
6 |
#define AI_EVENT_HPP |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
7 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
8 |
#include "ai_object.hpp" |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
9 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
10 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
11 |
* A single event that can be triggered by the game. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
12 |
* You can lookup the type, and than convert it to the real event-class. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
13 |
* That way you can request more detailed information about the event. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
14 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
15 |
class AIEvent : public AIObject { |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
16 |
public: |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
17 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
18 |
* The type of event. Needed to lookup the detailed class. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
19 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
20 |
enum AIEventType { |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
21 |
AI_ET_INVALID = 0, |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
22 |
AI_ET_TEST, |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
23 |
AI_ET_CRASHED_VEHICLE, |
9823
0b7f816cf46f
(svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents:
9683
diff
changeset
|
24 |
AI_ET_SUBSIDIARY_OFFER, |
9682
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
25 |
}; |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
26 |
|
9683
a4683b021073
(svn r10632) [NoAI] -Documentation: fix the documentation for AIEvent Constructor
truelight
parents:
9682
diff
changeset
|
27 |
/** |
a4683b021073
(svn r10632) [NoAI] -Documentation: fix the documentation for AIEvent Constructor
truelight
parents:
9682
diff
changeset
|
28 |
* Constructor of AIEvent, to get the type of event. |
a4683b021073
(svn r10632) [NoAI] -Documentation: fix the documentation for AIEvent Constructor
truelight
parents:
9682
diff
changeset
|
29 |
*/ |
9682
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
30 |
AIEvent(AIEvent::AIEventType type) : |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
31 |
type(type) |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
32 |
{} |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
33 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
34 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
35 |
* Get the event-type. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
36 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
37 |
AIEventType GetEventType() { return this->type; } |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
38 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
39 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
40 |
* The name of the class, needed by several sub-processes. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
41 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
42 |
static const char *GetClassName() { return "AIEvent"; } |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
43 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
44 |
protected: |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
45 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
46 |
* The type of this event. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
47 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
48 |
AIEventType type; |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
49 |
}; |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
50 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
51 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
52 |
* Class that handles all event related functions. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
53 |
* @note it is not needed to create an instance of AIEvent to access it, as |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
54 |
* all members are static, and all data is stored AI-wide. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
55 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
56 |
class AIEventController : public AIObject { |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
57 |
public: |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
58 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
59 |
* The name of the class, needed by several sub-processes. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
60 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
61 |
static const char *GetClassName() { return "AIEventController"; } |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
62 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
63 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
64 |
* Check if there is an event waiting. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
65 |
* @return true if there is an event on the stack. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
66 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
67 |
static bool IsEventWaiting(); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
68 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
69 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
70 |
* Get the next event. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
71 |
* @return a class of the event-child issues. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
72 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
73 |
static AIEvent *GetNextEvent(); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
74 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
75 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
76 |
* No longer report an event of this type. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
77 |
* @param event the event to no longer report. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
78 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
79 |
static void DisableEvent(AIEvent::AIEventType event); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
80 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
81 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
82 |
* Report events of this type. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
83 |
* @param event the event to report again. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
84 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
85 |
static void EnableEvent(AIEvent::AIEventType event); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
86 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
87 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
88 |
* Disable all events. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
89 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
90 |
static void DisableAllEvents(); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
91 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
92 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
93 |
* Enable all events. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
94 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
95 |
static void EnableAllEvents(); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
96 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
97 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
98 |
* Insert an event to the queue for the player. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
99 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
100 |
static void InsertEvent(AIEvent *event); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
101 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
102 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
103 |
* Give a test event to the system. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
104 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
105 |
static void Test(); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
106 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
107 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
108 |
* Free the event pointer. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
109 |
* @note DO NOT CALL YOURSELF; leave it to the internal AI programming. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
110 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
111 |
static void FreeEventPointer(); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
112 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
113 |
private: |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
114 |
/** |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
115 |
* Create the event pointer. |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
116 |
*/ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
117 |
static void CreateEventPointer(); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
118 |
}; |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
119 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
diff
changeset
|
120 |
#endif /* AI_EVENT_HPP */ |