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)
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 ***********************************************************************/
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
149 * Note: If you add a new event, make sure you make a similar change
150 * to the events array in "common/events.c" using GEN_EV, and to
151 * "data/stdsounds.soundspec", which serves as the documentation to
154 #define SPECENUM_COUNT E_COUNT
155 /* The sound system also generates "e_game_quit", although there's no
156 * corresponding identifier E_GAME_QUIT. */
157 #include "specenum_gen.h"
158 /* the maximum number of enumerators is set in generate_specnum.py */
160 extern enum event_type sorted_events
[]; /* [E_COUNT], sorted by the
161 translated message text */
163 const char *get_event_message_text(enum event_type event
);
164 const char *get_event_sound_tag(enum event_type event
);
166 bool is_city_event(enum event_type event
);
168 void events_init(void);
169 void events_free(void);
172 /* Iterates over all events, sorted by the message text string. */
173 #define sorted_event_iterate(event) \
175 enum event_type event; \
176 enum event_type event##_index; \
177 for (event##_index = event_type_begin(); \
178 event##_index != event_type_end(); \
179 event##_index = event_type_next(event##_index)) { \
180 event = sorted_events[event##_index]; \
183 #define sorted_event_iterate_end \
190 #endif /* __cplusplus */
192 #endif /* FC__EVENTS_H */