Stop sharing requirement_unit_state_ereq().
[freeciv.git] / common / events.h
blob93b9a5321155aca1eb115724e8d9532adaeacf1c
1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
13 #ifndef FC__EVENTS_H
14 #define FC__EVENTS_H
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
20 #include "support.h" /* bool type */
22 /* Used in the network protocol. */
23 #define SPECENUM_NAME event_type
24 #define SPECENUM_VALUE0 E_CITY_CANTBUILD
25 #define SPECENUM_VALUE1 E_CITY_LOST
26 #define SPECENUM_VALUE2 E_CITY_LOVE
27 #define SPECENUM_VALUE3 E_CITY_DISORDER
28 #define SPECENUM_VALUE4 E_CITY_FAMINE
29 #define SPECENUM_VALUE5 E_CITY_FAMINE_FEARED
30 #define SPECENUM_VALUE6 E_CITY_GROWTH
31 #define SPECENUM_VALUE7 E_CITY_MAY_SOON_GROW
32 #define SPECENUM_VALUE8 E_CITY_AQUEDUCT
33 #define SPECENUM_VALUE9 E_CITY_AQ_BUILDING
34 #define SPECENUM_VALUE10 E_CITY_NORMAL
35 #define SPECENUM_VALUE11 E_CITY_NUKED
36 #define SPECENUM_VALUE12 E_CITY_CMA_RELEASE
37 #define SPECENUM_VALUE13 E_CITY_GRAN_THROTTLE
38 #define SPECENUM_VALUE14 E_CITY_TRANSFER
39 #define SPECENUM_VALUE15 E_CITY_BUILD
40 #define SPECENUM_VALUE16 E_CITY_PRODUCTION_CHANGED
41 #define SPECENUM_VALUE17 E_WORKLIST
42 #define SPECENUM_VALUE18 E_UPRISING
43 #define SPECENUM_VALUE19 E_CIVIL_WAR
44 #define SPECENUM_VALUE20 E_ANARCHY
45 #define SPECENUM_VALUE21 E_FIRST_CONTACT
46 #define SPECENUM_VALUE22 E_NEW_GOVERNMENT
47 #define SPECENUM_VALUE23 E_LOW_ON_FUNDS
48 #define SPECENUM_VALUE24 E_POLLUTION
49 #define SPECENUM_VALUE25 E_REVOLT_DONE
50 #define SPECENUM_VALUE26 E_REVOLT_START
51 #define SPECENUM_VALUE27 E_SPACESHIP
52 #define SPECENUM_VALUE28 E_MY_DIPLOMAT_BRIBE
53 #define SPECENUM_VALUE29 E_DIPLOMATIC_INCIDENT
54 #define SPECENUM_VALUE30 E_MY_DIPLOMAT_ESCAPE
55 #define SPECENUM_VALUE31 E_MY_DIPLOMAT_EMBASSY
56 #define SPECENUM_VALUE32 E_MY_DIPLOMAT_FAILED
57 #define SPECENUM_VALUE33 E_MY_DIPLOMAT_INCITE
58 #define SPECENUM_VALUE34 E_MY_DIPLOMAT_POISON
59 #define SPECENUM_VALUE35 E_MY_DIPLOMAT_SABOTAGE
60 #define SPECENUM_VALUE36 E_MY_DIPLOMAT_THEFT
61 #define SPECENUM_VALUE37 E_ENEMY_DIPLOMAT_BRIBE
62 #define SPECENUM_VALUE38 E_ENEMY_DIPLOMAT_EMBASSY
63 #define SPECENUM_VALUE39 E_ENEMY_DIPLOMAT_FAILED
64 #define SPECENUM_VALUE40 E_ENEMY_DIPLOMAT_INCITE
65 #define SPECENUM_VALUE41 E_ENEMY_DIPLOMAT_POISON
66 #define SPECENUM_VALUE42 E_ENEMY_DIPLOMAT_SABOTAGE
67 #define SPECENUM_VALUE43 E_ENEMY_DIPLOMAT_THEFT
68 #define SPECENUM_VALUE44 E_CARAVAN_ACTION
69 #define SPECENUM_VALUE45 E_SCRIPT
70 #define SPECENUM_VALUE46 E_BROADCAST_REPORT
71 #define SPECENUM_VALUE47 E_GAME_END
72 #define SPECENUM_VALUE48 E_GAME_START
73 #define SPECENUM_VALUE49 E_NATION_SELECTED
74 #define SPECENUM_VALUE50 E_DESTROYED
75 #define SPECENUM_VALUE51 E_REPORT
76 #define SPECENUM_VALUE52 E_TURN_BELL
77 #define SPECENUM_VALUE53 E_NEXT_YEAR
78 #define SPECENUM_VALUE54 E_GLOBAL_ECO
79 #define SPECENUM_VALUE55 E_NUKE
80 #define SPECENUM_VALUE56 E_HUT_BARB
81 #define SPECENUM_VALUE57 E_HUT_CITY
82 #define SPECENUM_VALUE58 E_HUT_GOLD
83 #define SPECENUM_VALUE59 E_HUT_BARB_KILLED
84 #define SPECENUM_VALUE60 E_HUT_MERC
85 #define SPECENUM_VALUE61 E_HUT_SETTLER
86 #define SPECENUM_VALUE62 E_HUT_TECH
87 #define SPECENUM_VALUE63 E_HUT_BARB_CITY_NEAR
88 #define SPECENUM_VALUE64 E_IMP_BUY
89 #define SPECENUM_VALUE65 E_IMP_BUILD
90 #define SPECENUM_VALUE66 E_IMP_AUCTIONED
91 #define SPECENUM_VALUE67 E_IMP_AUTO
92 #define SPECENUM_VALUE68 E_IMP_SOLD
93 #define SPECENUM_VALUE69 E_TECH_GAIN
94 #define SPECENUM_VALUE70 E_TECH_LEARNED
95 #define SPECENUM_VALUE71 E_TREATY_ALLIANCE
96 #define SPECENUM_VALUE72 E_TREATY_BROKEN
97 #define SPECENUM_VALUE73 E_TREATY_CEASEFIRE
98 #define SPECENUM_VALUE74 E_TREATY_PEACE
99 #define SPECENUM_VALUE75 E_TREATY_SHARED_VISION
100 #define SPECENUM_VALUE76 E_UNIT_LOST_ATT
101 #define SPECENUM_VALUE77 E_UNIT_WIN_ATT
102 #define SPECENUM_VALUE78 E_UNIT_BUY
103 #define SPECENUM_VALUE79 E_UNIT_BUILT
104 #define SPECENUM_VALUE80 E_UNIT_LOST_DEF
105 #define SPECENUM_VALUE81 E_UNIT_WIN
106 #define SPECENUM_VALUE82 E_UNIT_BECAME_VET
107 #define SPECENUM_VALUE83 E_UNIT_UPGRADED
108 #define SPECENUM_VALUE84 E_UNIT_RELOCATED
109 #define SPECENUM_VALUE85 E_UNIT_ORDERS
110 #define SPECENUM_VALUE86 E_WONDER_BUILD
111 #define SPECENUM_VALUE87 E_WONDER_OBSOLETE
112 #define SPECENUM_VALUE88 E_WONDER_STARTED
113 #define SPECENUM_VALUE89 E_WONDER_STOPPED
114 #define SPECENUM_VALUE90 E_WONDER_WILL_BE_BUILT
115 #define SPECENUM_VALUE91 E_DIPLOMACY
116 #define SPECENUM_VALUE92 E_TREATY_EMBASSY
117 /* Illegal command sent from client. */
118 #define SPECENUM_VALUE93 E_BAD_COMMAND
119 /* Messages for changed server settings */
120 #define SPECENUM_VALUE94 E_SETTING
121 /* Chatline messages */
122 #define SPECENUM_VALUE95 E_CHAT_MSG
123 /* Message from server operator */
124 #define SPECENUM_VALUE96 E_MESSAGE_WALL
125 /* Chatline errors (bad syntax, etc.) */
126 #define SPECENUM_VALUE97 E_CHAT_ERROR
127 /* Messages about acquired or lost connections */
128 #define SPECENUM_VALUE98 E_CONNECTION
129 /* AI debugging messages */
130 #define SPECENUM_VALUE99 E_AI_DEBUG
131 /* Warning messages */
132 #define SPECENUM_VALUE100 E_LOG_ERROR
133 #define SPECENUM_VALUE101 E_LOG_FATAL
134 /* Changed tech goal */
135 #define SPECENUM_VALUE102 E_TECH_GOAL
136 /* Non-battle unit deaths */
137 #define SPECENUM_VALUE103 E_UNIT_LOST_MISC
138 /* Plague within a city */
139 #define SPECENUM_VALUE104 E_CITY_PLAGUE
140 #define SPECENUM_VALUE105 E_VOTE_NEW
141 #define SPECENUM_VALUE106 E_VOTE_RESOLVED
142 #define SPECENUM_VALUE107 E_VOTE_ABORTED
143 /* Change of the city radius */
144 #define SPECENUM_VALUE108 E_CITY_RADIUS_SQ
145 /* A unit with population cost was built; the city shrinks. */
146 #define SPECENUM_VALUE109 E_UNIT_BUILT_POP_COST
147 #define SPECENUM_VALUE110 E_DISASTER
148 #define SPECENUM_VALUE111 E_ACHIEVEMENT
149 #define SPECENUM_VALUE112 E_TECH_LOST
150 /* Used to notify tech events for foreigner players. */
151 #define SPECENUM_VALUE113 E_TECH_EMBASSY
152 #define SPECENUM_VALUE114 E_MY_SPY_STEAL_GOLD
153 #define SPECENUM_VALUE115 E_ENEMY_SPY_STEAL_GOLD
154 #define SPECENUM_VALUE116 E_SPONTANEOUS_EXTRA
155 #define SPECENUM_VALUE117 E_UNIT_ILLEGAL_ACTION
156 #define SPECENUM_VALUE118 E_MY_SPY_STEAL_MAP
157 #define SPECENUM_VALUE119 E_ENEMY_SPY_STEAL_MAP
158 #define SPECENUM_VALUE120 E_MY_SPY_NUKE
159 #define SPECENUM_VALUE121 E_ENEMY_SPY_NUKE
160 #define SPECENUM_VALUE122 E_UNIT_WAS_EXPELLED
161 #define SPECENUM_VALUE123 E_UNIT_DID_EXPEL
162 #define SPECENUM_VALUE124 E_UNIT_ACTION_FAILED
163 #define SPECENUM_VALUE125 E_UNIT_ESCAPED
164 #define SPECENUM_VALUE126 E_DEPRECATION_WARNING
165 /* Used for messages about things experienced players already know. */
166 #define SPECENUM_VALUE127 E_BEGINNER_HELP
168 * Note: If you add a new event, make sure you make a similar change
169 * to the events array in "common/events.c" using GEN_EV, to
170 * "data/stdsounds.soundspec", which serves as the documentation to
171 * soundset authors, and to "data/misc/events.spec".
173 #define SPECENUM_COUNT E_COUNT
174 /* The sound system also generates "e_game_quit", although there's no
175 * corresponding identifier E_GAME_QUIT. */
176 #include "specenum_gen.h"
177 /* the maximum number of enumerators is set in generate_specnum.py */
179 extern enum event_type sorted_events[]; /* [E_COUNT], sorted by the
180 translated message text */
182 const char *get_event_message_text(enum event_type event);
183 const char *get_event_tag(enum event_type event);
185 bool is_city_event(enum event_type event);
187 void events_init(void);
188 void events_free(void);
191 /* Iterates over all events, sorted by the message text string. */
192 #define sorted_event_iterate(event) \
194 enum event_type event; \
195 enum event_type event##_index; \
196 for (event##_index = event_type_begin(); \
197 event##_index != event_type_end(); \
198 event##_index = event_type_next(event##_index)) { \
199 event = sorted_events[event##_index]; \
202 #define sorted_event_iterate_end \
207 #ifdef __cplusplus
209 #endif /* __cplusplus */
211 #endif /* FC__EVENTS_H */