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