Freeciv-3.2: /fast/freeciv/nightly/S3_2/common/actions.h Source File

Freeciv-3.2

Loading...
Searching...
No Matches
actions.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996-2013 - Freeciv Development Team
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.
7
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
14#ifndef FC_ACTIONS_H
15#define FC_ACTIONS_H
16
17/* common */
18#include "actres.h"
19#include "fc_types.h"
20#include "map_types.h"
21#include "requirements.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif /* __cplusplus */
26
27/* If 'enum gen_action' has currently unused values that should
28 * not be used in 'switch - cases', put those cases here. E.g.:
29 *
30 *#define ASSERT_UNUSED_ACTION_CASES \
31 * case ACTION_UNUSED_1: \
32 * fc_assert_msg(FALSE, "ACTION_UNUSED_1"); \
33 * break; \
34 * case ACTION_UNUSED_2: \
35 * fc_assert_msg(FALSE, "ACTION_UNUSED_2"); \
36 * break;
37 */
38#define ASSERT_UNUSED_ACTION_CASES \
39
40
41#define SPECENUM_NAME action_actor_kind
42#define SPECENUM_VALUE0 AAK_UNIT
43#define SPECENUM_VALUE0NAME N_("a unit")
44#define SPECENUM_COUNT AAK_COUNT
45#include "specenum_gen.h"
46
47const char *gen_action_name_update_cb(const char *old_name);
48
49/* Values used in the network protocol. */
50/* Names used in file formats but not normally shown to users. */
51#define SPECENUM_NAME gen_action
52#define SPECENUM_VALUE0 ACTION_ESTABLISH_EMBASSY
53#define SPECENUM_VALUE0NAME "Establish Embassy"
54#define SPECENUM_VALUE1 ACTION_ESTABLISH_EMBASSY_STAY
55#define SPECENUM_VALUE1NAME "Establish Embassy Stay"
56#define SPECENUM_VALUE2 ACTION_SPY_INVESTIGATE_CITY
57#define SPECENUM_VALUE2NAME "Investigate City"
58#define SPECENUM_VALUE3 ACTION_INV_CITY_SPEND
59#define SPECENUM_VALUE3NAME "Investigate City Spend Unit"
60#define SPECENUM_VALUE4 ACTION_SPY_POISON
61#define SPECENUM_VALUE4NAME "Poison City"
62#define SPECENUM_VALUE5 ACTION_SPY_POISON_ESC
63#define SPECENUM_VALUE5NAME "Poison City Escape"
64#define SPECENUM_VALUE6 ACTION_SPY_STEAL_GOLD
65#define SPECENUM_VALUE6NAME "Steal Gold"
66#define SPECENUM_VALUE7 ACTION_SPY_STEAL_GOLD_ESC
67#define SPECENUM_VALUE7NAME "Steal Gold Escape"
68#define SPECENUM_VALUE8 ACTION_SPY_SABOTAGE_CITY
69#define SPECENUM_VALUE8NAME "Sabotage City"
70#define SPECENUM_VALUE9 ACTION_SPY_SABOTAGE_CITY_ESC
71#define SPECENUM_VALUE9NAME "Sabotage City Escape"
72#define SPECENUM_VALUE10 ACTION_SPY_TARGETED_SABOTAGE_CITY
73#define SPECENUM_VALUE10NAME "Targeted Sabotage City"
74#define SPECENUM_VALUE11 ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC
75#define SPECENUM_VALUE11NAME "Targeted Sabotage City Escape"
76#define SPECENUM_VALUE12 ACTION_SPY_SABOTAGE_CITY_PRODUCTION
77#define SPECENUM_VALUE12NAME "Sabotage City Production"
78#define SPECENUM_VALUE13 ACTION_SPY_SABOTAGE_CITY_PRODUCTION_ESC
79#define SPECENUM_VALUE13NAME "Sabotage City Production Escape"
80#define SPECENUM_VALUE14 ACTION_SPY_STEAL_TECH
81#define SPECENUM_VALUE14NAME "Steal Tech"
82#define SPECENUM_VALUE15 ACTION_SPY_STEAL_TECH_ESC
83#define SPECENUM_VALUE15NAME "Steal Tech Escape Expected"
84#define SPECENUM_VALUE16 ACTION_SPY_TARGETED_STEAL_TECH
85#define SPECENUM_VALUE16NAME "Targeted Steal Tech"
86#define SPECENUM_VALUE17 ACTION_SPY_TARGETED_STEAL_TECH_ESC
87#define SPECENUM_VALUE17NAME "Targeted Steal Tech Escape Expected"
88#define SPECENUM_VALUE18 ACTION_SPY_INCITE_CITY
89#define SPECENUM_VALUE18NAME "Incite City"
90#define SPECENUM_VALUE19 ACTION_SPY_INCITE_CITY_ESC
91#define SPECENUM_VALUE19NAME "Incite City Escape"
92#define SPECENUM_VALUE20 ACTION_TRADE_ROUTE
93#define SPECENUM_VALUE20NAME "Establish Trade Route"
94#define SPECENUM_VALUE21 ACTION_MARKETPLACE
95#define SPECENUM_VALUE21NAME "Enter Marketplace"
96#define SPECENUM_VALUE22 ACTION_HELP_WONDER
97#define SPECENUM_VALUE22NAME "Help Wonder"
98#define SPECENUM_VALUE23 ACTION_SPY_BRIBE_UNIT
99#define SPECENUM_VALUE23NAME "Bribe Unit"
100#define SPECENUM_VALUE24 ACTION_CAPTURE_UNITS
101#define SPECENUM_VALUE24NAME "Capture Units"
102#define SPECENUM_VALUE25 ACTION_SPY_SABOTAGE_UNIT
103#define SPECENUM_VALUE25NAME "Sabotage Unit"
104#define SPECENUM_VALUE26 ACTION_SPY_SABOTAGE_UNIT_ESC
105#define SPECENUM_VALUE26NAME "Sabotage Unit Escape"
106#define SPECENUM_VALUE27 ACTION_FOUND_CITY
107#define SPECENUM_VALUE27NAME "Found City"
108#define SPECENUM_VALUE28 ACTION_JOIN_CITY
109#define SPECENUM_VALUE28NAME "Join City"
110#define SPECENUM_VALUE29 ACTION_STEAL_MAPS
111#define SPECENUM_VALUE29NAME "Steal Maps"
112#define SPECENUM_VALUE30 ACTION_STEAL_MAPS_ESC
113#define SPECENUM_VALUE30NAME "Steal Maps Escape"
114#define SPECENUM_VALUE31 ACTION_SPY_NUKE
115#define SPECENUM_VALUE31NAME "Suitcase Nuke"
116#define SPECENUM_VALUE32 ACTION_SPY_NUKE_ESC
117#define SPECENUM_VALUE32NAME "Suitcase Nuke Escape"
118#define SPECENUM_VALUE33 ACTION_NUKE
119#define SPECENUM_VALUE33NAME "Explode Nuclear"
120#define SPECENUM_VALUE34 ACTION_NUKE_CITY
121#define SPECENUM_VALUE34NAME "Nuke City"
122#define SPECENUM_VALUE35 ACTION_NUKE_UNITS
123#define SPECENUM_VALUE35NAME "Nuke Units"
124#define SPECENUM_VALUE36 ACTION_DESTROY_CITY
125#define SPECENUM_VALUE36NAME "Destroy City"
126#define SPECENUM_VALUE37 ACTION_EXPEL_UNIT
127#define SPECENUM_VALUE37NAME "Expel Unit"
128#define SPECENUM_VALUE38 ACTION_DISBAND_UNIT_RECOVER
129#define SPECENUM_VALUE38NAME "Disband Unit Recover"
130#define SPECENUM_VALUE39 ACTION_DISBAND_UNIT
131#define SPECENUM_VALUE39NAME "Disband Unit"
132#define SPECENUM_VALUE40 ACTION_HOME_CITY
133#define SPECENUM_VALUE40NAME "Home City"
134#define SPECENUM_VALUE41 ACTION_HOMELESS
135#define SPECENUM_VALUE41NAME "Unit Make Homeless"
136#define SPECENUM_VALUE42 ACTION_UPGRADE_UNIT
137#define SPECENUM_VALUE42NAME "Upgrade Unit"
138#define SPECENUM_VALUE43 ACTION_CONVERT
139#define SPECENUM_VALUE43NAME "Convert Unit"
140#define SPECENUM_VALUE44 ACTION_AIRLIFT
141#define SPECENUM_VALUE44NAME "Airlift Unit"
142#define SPECENUM_VALUE45 ACTION_ATTACK
143#define SPECENUM_VALUE45NAME "Attack"
144#define SPECENUM_VALUE46 ACTION_ATTACK2
145#define SPECENUM_VALUE46NAME "Attack 2"
146#define SPECENUM_VALUE47 ACTION_SUICIDE_ATTACK
147#define SPECENUM_VALUE47NAME "Suicide Attack"
148#define SPECENUM_VALUE48 ACTION_SUICIDE_ATTACK2
149#define SPECENUM_VALUE48NAME "Suicide Attack 2"
150#define SPECENUM_VALUE49 ACTION_STRIKE_BUILDING
151#define SPECENUM_VALUE49NAME "Surgical Strike Building"
152#define SPECENUM_VALUE50 ACTION_STRIKE_PRODUCTION
153#define SPECENUM_VALUE50NAME "Surgical Strike Production"
154#define SPECENUM_VALUE51 ACTION_CONQUER_CITY
155#define SPECENUM_VALUE51NAME "Conquer City"
156#define SPECENUM_VALUE52 ACTION_CONQUER_CITY2
157#define SPECENUM_VALUE52NAME "Conquer City 2"
158#define SPECENUM_VALUE53 ACTION_CONQUER_CITY3
159#define SPECENUM_VALUE53NAME "Conquer City 3"
160#define SPECENUM_VALUE54 ACTION_CONQUER_CITY4
161#define SPECENUM_VALUE54NAME "Conquer City 4"
162#define SPECENUM_VALUE55 ACTION_BOMBARD
163#define SPECENUM_VALUE55NAME "Bombard"
164#define SPECENUM_VALUE56 ACTION_BOMBARD2
165#define SPECENUM_VALUE56NAME "Bombard 2"
166#define SPECENUM_VALUE57 ACTION_BOMBARD3
167#define SPECENUM_VALUE57NAME "Bombard 3"
168#define SPECENUM_VALUE58 ACTION_BOMBARD_LETHAL
169#define SPECENUM_VALUE58NAME "Bombard Lethal"
170#define SPECENUM_VALUE59 ACTION_BOMBARD_LETHAL2
171#define SPECENUM_VALUE59NAME "Bombard Lethal 2"
172#define SPECENUM_VALUE60 ACTION_FORTIFY
173#define SPECENUM_VALUE60NAME "Fortify"
174#define SPECENUM_VALUE61 ACTION_CULTIVATE
175#define SPECENUM_VALUE61NAME "Cultivate"
176#define SPECENUM_VALUE62 ACTION_PLANT
177#define SPECENUM_VALUE62NAME "Plant"
178#define SPECENUM_VALUE63 ACTION_TRANSFORM_TERRAIN
179#define SPECENUM_VALUE63NAME "Transform Terrain"
180#define SPECENUM_VALUE64 ACTION_ROAD
181#define SPECENUM_VALUE64NAME "Build Road"
182#define SPECENUM_VALUE65 ACTION_IRRIGATE
183#define SPECENUM_VALUE65NAME "Build Irrigation"
184#define SPECENUM_VALUE66 ACTION_MINE
185#define SPECENUM_VALUE66NAME "Build Mine"
186#define SPECENUM_VALUE67 ACTION_BASE
187#define SPECENUM_VALUE67NAME "Build Base"
188#define SPECENUM_VALUE68 ACTION_PILLAGE
189#define SPECENUM_VALUE68NAME "Pillage"
190#define SPECENUM_VALUE69 ACTION_TRANSPORT_BOARD
191#define SPECENUM_VALUE69NAME "Transport Board"
192#define SPECENUM_VALUE70 ACTION_TRANSPORT_BOARD2
193#define SPECENUM_VALUE70NAME "Transport Board 2"
194#define SPECENUM_VALUE71 ACTION_TRANSPORT_BOARD3
195#define SPECENUM_VALUE71NAME "Transport Board_3"
196#define SPECENUM_VALUE72 ACTION_TRANSPORT_DEBOARD
197#define SPECENUM_VALUE72NAME "Transport Deboard"
198#define SPECENUM_VALUE73 ACTION_TRANSPORT_EMBARK
199#define SPECENUM_VALUE73NAME "Transport Embark"
200#define SPECENUM_VALUE74 ACTION_TRANSPORT_EMBARK2
201#define SPECENUM_VALUE74NAME "Transport Embark 2"
202#define SPECENUM_VALUE75 ACTION_TRANSPORT_EMBARK3
203#define SPECENUM_VALUE75NAME "Transport Embark 3"
204#define SPECENUM_VALUE76 ACTION_TRANSPORT_EMBARK4
205#define SPECENUM_VALUE76NAME "Transport Embark 4"
206#define SPECENUM_VALUE77 ACTION_TRANSPORT_DISEMBARK1
207#define SPECENUM_VALUE77NAME "Transport Disembark"
208#define SPECENUM_VALUE78 ACTION_TRANSPORT_DISEMBARK2
209#define SPECENUM_VALUE78NAME "Transport Disembark 2"
210#define SPECENUM_VALUE79 ACTION_TRANSPORT_DISEMBARK3
211#define SPECENUM_VALUE79NAME "Transport Disembark 3"
212#define SPECENUM_VALUE80 ACTION_TRANSPORT_DISEMBARK4
213#define SPECENUM_VALUE80NAME "Transport Disembark 4"
214#define SPECENUM_VALUE81 ACTION_TRANSPORT_LOAD
215#define SPECENUM_VALUE81NAME "Transport Load"
216#define SPECENUM_VALUE82 ACTION_TRANSPORT_LOAD2
217#define SPECENUM_VALUE82NAME "Transport Load 2"
218#define SPECENUM_VALUE83 ACTION_TRANSPORT_LOAD3
219#define SPECENUM_VALUE83NAME "Transport Load 3"
220#define SPECENUM_VALUE84 ACTION_TRANSPORT_UNLOAD
221#define SPECENUM_VALUE84NAME "Transport Unload"
222#define SPECENUM_VALUE85 ACTION_SPY_SPREAD_PLAGUE
223#define SPECENUM_VALUE85NAME "Spread Plague"
224#define SPECENUM_VALUE86 ACTION_SPY_ATTACK
225#define SPECENUM_VALUE86NAME "Spy Attack"
226#define SPECENUM_VALUE87 ACTION_CONQUER_EXTRAS
227#define SPECENUM_VALUE87NAME "Conquer Extras"
228#define SPECENUM_VALUE88 ACTION_CONQUER_EXTRAS2
229#define SPECENUM_VALUE88NAME "Conquer Extras 2"
230#define SPECENUM_VALUE89 ACTION_CONQUER_EXTRAS3
231#define SPECENUM_VALUE89NAME "Conquer Extras 3"
232#define SPECENUM_VALUE90 ACTION_CONQUER_EXTRAS4
233#define SPECENUM_VALUE90NAME "Conquer Extras 4"
234#define SPECENUM_VALUE91 ACTION_HUT_ENTER
235#define SPECENUM_VALUE91NAME "Enter Hut"
236#define SPECENUM_VALUE92 ACTION_HUT_ENTER2
237#define SPECENUM_VALUE92NAME "Enter Hut 2"
238#define SPECENUM_VALUE93 ACTION_HUT_ENTER3
239#define SPECENUM_VALUE93NAME "Enter Hut 3"
240#define SPECENUM_VALUE94 ACTION_HUT_ENTER4
241#define SPECENUM_VALUE94NAME "Enter Hut 4"
242#define SPECENUM_VALUE95 ACTION_HUT_FRIGHTEN
243#define SPECENUM_VALUE95NAME "Frighten Hut"
244#define SPECENUM_VALUE96 ACTION_HUT_FRIGHTEN2
245#define SPECENUM_VALUE96NAME "Frighten Hut 2"
246#define SPECENUM_VALUE97 ACTION_HUT_FRIGHTEN3
247#define SPECENUM_VALUE97NAME "Frighten Hut 3"
248#define SPECENUM_VALUE98 ACTION_HUT_FRIGHTEN4
249#define SPECENUM_VALUE98NAME "Frighten Hut 4"
250#define SPECENUM_VALUE99 ACTION_HEAL_UNIT
251#define SPECENUM_VALUE99NAME "Heal Unit"
252#define SPECENUM_VALUE100 ACTION_HEAL_UNIT2
253#define SPECENUM_VALUE100NAME "Heal Unit 2"
254#define SPECENUM_VALUE101 ACTION_PARADROP
255#define SPECENUM_VALUE101NAME "Paradrop Unit"
256#define SPECENUM_VALUE102 ACTION_PARADROP_CONQUER
257#define SPECENUM_VALUE102NAME "Paradrop Unit Conquer"
258#define SPECENUM_VALUE103 ACTION_PARADROP_FRIGHTEN
259#define SPECENUM_VALUE103NAME "Paradrop Unit Frighten"
260#define SPECENUM_VALUE104 ACTION_PARADROP_FRIGHTEN_CONQUER
261#define SPECENUM_VALUE104NAME "Paradrop Unit Frighten Conquer"
262#define SPECENUM_VALUE105 ACTION_PARADROP_ENTER
263#define SPECENUM_VALUE105NAME "Paradrop Unit Enter"
264#define SPECENUM_VALUE106 ACTION_PARADROP_ENTER_CONQUER
265#define SPECENUM_VALUE106NAME "Paradrop Unit Enter Conquer"
266#define SPECENUM_VALUE107 ACTION_WIPE_UNITS
267#define SPECENUM_VALUE107NAME "Wipe Units"
268#define SPECENUM_VALUE108 ACTION_SPY_ESCAPE
269#define SPECENUM_VALUE108NAME "Spy Escape"
270#define SPECENUM_VALUE109 ACTION_UNIT_MOVE
271#define SPECENUM_VALUE109NAME "Unit Move"
272#define SPECENUM_VALUE110 ACTION_UNIT_MOVE2
273#define SPECENUM_VALUE110NAME "Unit Move 2"
274#define SPECENUM_VALUE111 ACTION_UNIT_MOVE3
275#define SPECENUM_VALUE111NAME "Unit Move 3"
276#define SPECENUM_VALUE112 ACTION_TELEPORT
277#define SPECENUM_VALUE112NAME "Teleport"
278#define SPECENUM_VALUE113 ACTION_TELEPORT_CONQUER
279#define SPECENUM_VALUE113NAME "Teleport Conquer"
280#define SPECENUM_VALUE114 ACTION_TELEPORT_FRIGHTEN
281#define SPECENUM_VALUE114NAME "Teleport Frighten"
282#define SPECENUM_VALUE115 ACTION_TELEPORT_FRIGHTEN_CONQUER
283#define SPECENUM_VALUE115NAME "Teleport Frighten Conquer"
284#define SPECENUM_VALUE116 ACTION_TELEPORT_ENTER
285#define SPECENUM_VALUE116NAME "Teleport Enter"
286#define SPECENUM_VALUE117 ACTION_TELEPORT_ENTER_CONQUER
287#define SPECENUM_VALUE117NAME "Teleport Enter Conquer"
288#define SPECENUM_VALUE118 ACTION_CLEAN
289#define SPECENUM_VALUE118NAME "Clean"
290#define SPECENUM_VALUE119 ACTION_COLLECT_RANSOM
291#define SPECENUM_VALUE119NAME "Collect Ransom"
292#define SPECENUM_VALUE120 ACTION_USER_ACTION1
293#define SPECENUM_VALUE120NAME "User Action 1"
294#define SPECENUM_VALUE121 ACTION_USER_ACTION2
295#define SPECENUM_VALUE121NAME "User Action 2"
296#define SPECENUM_VALUE122 ACTION_USER_ACTION3
297#define SPECENUM_VALUE122NAME "User Action 3"
298#define SPECENUM_VALUE123 ACTION_USER_ACTION4
299#define SPECENUM_VALUE123NAME "User Action 4"
300#define SPECENUM_BITVECTOR bv_actions
301#define SPECENUM_COUNT ACTION_COUNT
302#define SPECENUM_NAME_UPDATER
303#include "specenum_gen.h"
304
305/* Fake action id used in searches to signal "any action at all". */
306#define ACTION_ANY ACTION_COUNT
307
308/* Fake action id used to signal the absence of any actions. */
309#define ACTION_NONE ACTION_COUNT
310
311/* Used in the network protocol. */
312#define MAX_NUM_ACTIONS ACTION_COUNT
313#define NUM_ACTIONS MAX_NUM_ACTIONS
314
315/* Describes how a unit successfully performing an action will move it. */
316#define SPECENUM_NAME moves_actor_kind
317#define SPECENUM_VALUE0 MAK_STAYS
318#define SPECENUM_VALUE0NAME N_("stays")
319#define SPECENUM_VALUE1 MAK_REGULAR
320#define SPECENUM_VALUE1NAME N_("regular")
321#define SPECENUM_VALUE2 MAK_TELEPORT
322#define SPECENUM_VALUE2NAME N_("teleport")
323#define SPECENUM_VALUE3 MAK_ESCAPE
324#define SPECENUM_VALUE3NAME N_("escape")
325#define SPECENUM_VALUE4 MAK_FORCED
326#define SPECENUM_VALUE4NAME N_("forced")
327#define SPECENUM_VALUE5 MAK_UNREPRESENTABLE
328#define SPECENUM_VALUE5NAME N_("unrepresentable")
329#include "specenum_gen.h"
330
331/* Who ordered the action to be performed? */
332#define SPECENUM_NAME action_requester
333/* The player ordered it directly. */
334#define SPECENUM_VALUE0 ACT_REQ_PLAYER
335#define SPECENUM_VALUE0NAME N_("the player")
336/* The game it self because the rules requires it. */
337#define SPECENUM_VALUE1 ACT_REQ_RULES
338#define SPECENUM_VALUE1NAME N_("the game rules")
339/* A server side autonomous agent working for the player. */
340#define SPECENUM_VALUE2 ACT_REQ_SS_AGENT
341#define SPECENUM_VALUE2NAME N_("a server agent")
342/* Number of action requesters. */
343#define SPECENUM_COUNT ACT_REQ_COUNT
344#include "specenum_gen.h"
345
346/* The last action distance value that is interpreted as an actual
347 * distance rather than as a signal value.
348 *
349 * It is specified literally rather than referring to MAP_DISTANCE_MAX
350 * because Freeciv-web's MAP_DISTANCE_MAX differs from the regular Freeciv
351 * server's MAP_DISTANCE_MAX. A static assertion in actions.c makes sure
352 * that it can cover the whole map. */
353#define ACTION_DISTANCE_LAST_NON_SIGNAL 128016
354/* No action max distance to target limit. */
355#define ACTION_DISTANCE_UNLIMITED (ACTION_DISTANCE_LAST_NON_SIGNAL + 1)
356/* No action max distance can be bigger than this. */
357#define ACTION_DISTANCE_MAX ACTION_DISTANCE_UNLIMITED
358
359 struct action
360{
361 action_id id;
362
363 enum action_result result;
364 bv_action_sub_results sub_results;
365
366 enum action_actor_kind actor_kind;
367 enum action_target_kind target_kind;
368 enum action_sub_target_kind sub_target_kind;
369
370 /* Sub target policy. */
371 enum act_tgt_compl target_complexity;
372
373 /* Limits on the distance on the map between the actor and the target.
374 * The action is legal iff the distance is min_distance, max_distance or
375 * a value in between. */
376 int min_distance, max_distance;
377
378 /* The name of the action shown in the UI */
379 char ui_name[MAX_LEN_NAME];
380
381 /* Suppress automatic help text generation about what enables and/or
382 * disables this action. */
383 bool quiet;
384
385 /* Actions that blocks this action. The action will be illegal if any
386 * bloking action is legal. */
387 bv_actions blocked_by;
388
389 /* Successfully performing this action will always consume the actor.
390 * Don't set this for actions that consumes the unit in some cases
391 * (depending on luck, the presence of a flag, etc) but not in other
392 * cases. */
393 bool actor_consuming_always;
394
395 union {
396 struct {
397 /* A unit's ability to perform this action will pop up the action
398 * selection dialog before the player asks for it only in exceptional
399 * cases.
400 *
401 * The motivation for setting rare_pop_up is to minimize player
402 * annoyance and mistakes. Getting a pop up every time a unit moves is
403 * annoying. An unexpected offer to do something that in many cases is
404 * destructive can lead the player's muscle memory to perform the
405 * wrong action. */
406 bool rare_pop_up;
407
408 /* The unitwaittime setting blocks this action when done too soon. */
409 bool unitwaittime_controlled;
410
411 /* How successfully performing the specified action always will move
412 * the actor unit of the specified type. */
413 enum moves_actor_kind moves_actor;
414 } is_unit;
415 } actor;
416};
417
418 struct action_enabler
419{
420 action_id action;
421 struct requirement_vector actor_reqs;
422 struct requirement_vector target_reqs;
423
424 /* Only relevant for ruledit and other rulesave users. Indicates that
425 * this action enabler is deleted and shouldn't be saved. */
426 bool ruledit_disabled;
427};
428
429#define action_has_result(_act_, _res_) ((_act_)->result == (_res_))
430
431#define enabler_get_action(_enabler_) action_by_number(_enabler_->action)
432#define enabler_get_action_id(_enabler_) (_enabler_->action)
433
434#define SPECLIST_TAG action_enabler
435#define SPECLIST_TYPE struct action_enabler
436#include "speclist.h"
437#define action_enabler_list_iterate(action_enabler_list, aenabler) \
438 TYPED_LIST_ITERATE(struct action_enabler, action_enabler_list, aenabler)
439#define action_enabler_list_iterate_end LIST_ITERATE_END
440
441#define action_enabler_list_re_iterate(action_enabler_list, aenabler) \
442 action_enabler_list_iterate(action_enabler_list, aenabler) { \
443 if (!aenabler->ruledit_disabled) {
444
445#define action_enabler_list_re_iterate_end \
446 } \
447 } action_enabler_list_iterate_end
448
449#define action_iterate_all(_act_) \
450{ \
451 action_id _act_; \
452 for (_act_ = 0; _act_ < NUM_ACTIONS; _act_++) {
453
454#define action_iterate_all_end \
455 } \
456}
457
458/* Filter out unused action slots, in versions where those exist */
459#define action_iterate(_act_) \
460{ \
461 action_iterate_all(_act_) {
462
463#define action_iterate_end \
464 } action_iterate_all_end; \
465}
466
467/* Get 'struct action_id_list' and related functions: */
468#define SPECLIST_TAG action
469#define SPECLIST_TYPE struct action
470#include "speclist.h"
471
472#define action_list_iterate(_list_, _act_) \
473 TYPED_LIST_ITERATE(struct action, _list_, _act_)
474#define action_list_iterate_end LIST_ITERATE_END
475
476struct action_list *action_list_by_result(enum action_result result);
477struct action_list *action_list_by_activity(enum unit_activity activity);
478
479#define action_by_result_iterate(_paction_, _result_) \
480{ \
481 action_list_iterate(action_list_by_result(_result_), _paction_) { \
482
483#define action_by_result_iterate_end \
484 } action_list_iterate_end; \
485}
486
487#define action_by_activity_iterate(_paction_, _activity_) \
488{ \
489 action_list_iterate(action_list_by_activity(_activity_), _paction_) {
490
491#define action_by_activity_iterate_end \
492 } action_list_iterate_end; \
493}
494
495#define action_array_iterate(_act_array_, _act_id_) \
496{ \
497 int _pos_; \
498 \
499 for (_pos_ = 0; _pos_ < NUM_ACTIONS; _pos_++) { \
500 const action_id _act_id_ = _act_array_[_pos_]; \
501 \
502 if (_act_id_ == ACTION_NONE) { \
503 /* No more actions in this list. */ \
504 break; \
505 }
506
507#define action_array_iterate_end \
508 } \
509}
510
511#define action_enablers_iterate(_enabler_) \
512{ \
513 action_iterate(_act_) { \
514 action_enabler_list_iterate( \
515 action_enablers_for_action(_act_), _enabler_) {
516
517#define action_enablers_iterate_end \
518 } action_enabler_list_iterate_end; \
519 } action_iterate_end; \
520}
521
522/* The reason why an action should be auto performed. */
523#define SPECENUM_NAME action_auto_perf_cause
524/* Can't pay the unit's upkeep. */
525/* (Can be triggered by food, shield or gold upkeep) */
526#define SPECENUM_VALUE0 AAPC_UNIT_UPKEEP
527#define SPECENUM_VALUE0NAME "Unit Upkeep"
528/* A unit moved to an adjacent tile (auto attack). */
529#define SPECENUM_VALUE1 AAPC_UNIT_MOVED_ADJ
530#define SPECENUM_VALUE1NAME "Moved Adjacent"
531/* An action was successfully performed and the (action specific) conditions
532 * for forcing a post action move are fulfilled. */
533#define SPECENUM_VALUE2 AAPC_POST_ACTION
534#define SPECENUM_VALUE2NAME "After Successful Action"
535/* The city that made the unit's current tile native is gone. Evaluated
536 * against an adjacent tile. */
537#define SPECENUM_VALUE3 AAPC_CITY_GONE
538#define SPECENUM_VALUE3NAME "City Gone"
539/* The unit's stack has been defeated and is scheduled for execution but the
540 * unit has the CanEscape unit type flag.
541 * Evaluated against an adjacent tile. */
542#define SPECENUM_VALUE4 AAPC_UNIT_STACK_DEATH
543#define SPECENUM_VALUE4NAME "Unit Stack Dead"
544/* Number of forced action auto performer causes. */
545#define SPECENUM_COUNT AAPC_COUNT
546#include "specenum_gen.h"
547
548/* An Action Auto Performer rule makes an actor try to perform an action
549 * without being ordered to do so by the player controlling it.
550 * - the first auto performer that matches the cause and fulfills the reqs
551 * is selected.
552 * - the actions listed by the selected auto performer is tried in order
553 * until an action is successful, all actions have been tried or the
554 * actor disappears.
555 * - if no action inside the selected auto performer is legal no action is
556 * performed. The system won't try to select another auto performer.
557 */
558 struct action_auto_perf
559{
560 /* The reason for trying to auto perform an action. */
561 enum action_auto_perf_cause cause;
562
563 /* Must be fulfilled if the game should try to force an action from this
564 * action auto performer. */
565 struct requirement_vector reqs;
566
567 /* Auto perform the first legal action in this list.
568 * The list is terminated by ACTION_NONE. */
569 action_id alternatives[MAX_NUM_ACTIONS];
570};
571
572#define action_auto_perf_iterate(_act_perf_) \
573{ \
574 int _ap_num_; \
575 \
576 for (_ap_num_ = 0; \
577 _ap_num_ < MAX_NUM_ACTION_AUTO_PERFORMERS \
578 && (action_auto_perf_by_number(_ap_num_)->cause \
579 != AAPC_COUNT); \
580 _ap_num_++) { \
581 const struct action_auto_perf *_act_perf_ \
582 = action_auto_perf_by_number(_ap_num_);
583
584#define action_auto_perf_iterate_end \
585 } \
586}
587
588#define action_auto_perf_by_cause_iterate(_cause_, _act_perf_) \
589action_auto_perf_iterate(_act_perf_) { \
590 if (_act_perf_->cause != _cause_) { \
591 continue; \
592 }
593
594#define action_auto_perf_by_cause_iterate_end \
595} action_auto_perf_iterate_end
596
597#define action_auto_perf_actions_iterate(_autoperf_, _act_id_) \
598 action_array_iterate(_autoperf_->alternatives, _act_id_)
599
600#define action_auto_perf_actions_iterate_end \
601 action_array_iterate_end
602
603/* Hard coded location of action auto performers. Used for conversion while
604 * action auto performers aren't directly exposed to the ruleset.
605 * Remember to update also MAX_NUM_ACTION_AUTO_PERFORMERS when changing these. */
606#define ACTION_AUTO_UPKEEP_FOOD 0
607#define ACTION_AUTO_UPKEEP_GOLD 1
608#define ACTION_AUTO_UPKEEP_SHIELD 2
609#define ACTION_AUTO_MOVED_ADJ 3
610#define ACTION_AUTO_POST_BRIBE 4
611#define ACTION_AUTO_POST_ATTACK 5
612#define ACTION_AUTO_POST_ATTACK2 6
613#define ACTION_AUTO_POST_COLLECT_RANSOM 7
614#define ACTION_AUTO_ESCAPE_CITY 8
615#define ACTION_AUTO_ESCAPE_STACK 9
616#define ACTION_AUTO_POST_WIPE_UNITS 10
617
618/* Initialization */
619void actions_init(void);
620void actions_rs_pre_san_gen(void);
621void actions_free(void);
622
623bool actions_are_ready(void);
624
625bool action_id_exists(const action_id act_id);
626
627extern struct action **_actions;
628/**********************************************************************/
633 static inline struct action *action_by_number(action_id act_id)
634{
635 if (!gen_action_is_valid((enum gen_action)act_id)) {
636 return NULL;
637 }
638
639 /* We return NULL if there's NULL there, no need to special case it */
640 return _actions[act_id];
641}
642
643struct action *action_by_rule_name(const char *name);
644
645enum action_actor_kind action_get_actor_kind(const struct action *paction);
646#define action_id_get_actor_kind(act_id) \
647 action_get_actor_kind(action_by_number(act_id))
648enum action_target_kind action_get_target_kind(
649 const struct action *paction);
650#define action_id_get_target_kind(act_id) \
651 action_get_target_kind(action_by_number(act_id))
652enum action_sub_target_kind action_get_sub_target_kind(
653 const struct action *paction);
654#define action_id_get_sub_target_kind(act_id) \
655 action_get_sub_target_kind(action_by_number(act_id))
656
657int action_number(const struct action *action);
658
659#define action_id(_act_) (_act_->id)
660
661#define action_has_result_safe(paction, result) \
662 (paction && action_has_result(paction, result))
663#define action_id_has_result_safe(act_id, result) \
664 (action_by_number(act_id) \
665 && action_has_result(action_by_number(act_id), result))
666
667bool action_has_complex_target(const struct action *paction);
668#define action_id_has_complex_target(act_id) \
669 action_has_complex_target(action_by_number(act_id))
670bool action_requires_details(const struct action *paction);
671#define action_id_requires_details(act_id) \
672 action_requires_details(action_by_number(act_id))
673
674#define action_id_get_act_time(act_id, actor_unit, tgt_tile, tgt_extra) \
675 actres_get_act_time(action_by_number(act_id)->result, \
676 actor_unit, tgt_tile, tgt_extra)
677
678bool action_id_is_rare_pop_up(action_id act_id);
679
680bool action_distance_accepted(const struct action *action,
681 const int distance);
682#define action_id_distance_accepted(act_id, distance) \
683 action_distance_accepted(action_by_number(act_id), distance)
684
685bool action_distance_inside_max(const struct action *action,
686 const int distance);
687#define action_id_distance_inside_max(act_id, distance) \
688 action_distance_inside_max(action_by_number(act_id), distance)
689
690bool action_would_be_blocked_by(const struct action *blocked,
691 const struct action *blocker);
692
693int action_get_role(const struct action *paction);
694#define action_id_get_role(act_id) \
695 action_get_role(action_by_number(act_id))
696
697#define action_get_activity(_pact_) \
698 actres_activity_result(_pact_->result)
699#define action_id_get_activity(act_id) \
700 action_get_activity(action_by_number(act_id))
701
702const char *action_rule_name(const struct action *action);
703const char *action_id_rule_name(action_id act_id);
704
705const char *action_name_translation(const struct action *action);
706const char *action_id_name_translation(action_id act_id);
707const char *action_get_ui_name_mnemonic(action_id act_id,
708 const char *mnemonic);
709const char *action_prepare_ui_name(action_id act_id, const char *mnemonic,
710 const struct act_prob prob,
711 const char *custom);
712
713const char *action_ui_name_ruleset_var_name(int act);
714const char *action_ui_name_default(int act);
715
716const char *action_min_range_ruleset_var_name(int act);
717const char *action_max_range_ruleset_var_name(int act);
718
719const char *action_target_kind_ruleset_var_name(int act);
720const char *action_target_kind_help(enum action_target_kind kind);
721
722const char *action_actor_consuming_always_ruleset_var_name(action_id act);
723
724const char *action_blocked_by_ruleset_var_name(const struct action *act);
725
726const char *
727 action_post_success_forced_ruleset_var_name(const struct action *act);
728
729bool action_ever_possible(action_id action);
730
731struct action_enabler_list *
732 action_enablers_for_action(action_id action);
733
734struct action_enabler *action_enabler_new(void);
735void action_enabler_free(struct action_enabler *enabler);
736struct action_enabler *
737 action_enabler_copy(const struct action_enabler *original);
738void action_enabler_add(struct action_enabler *enabler);
739bool action_enabler_remove(struct action_enabler *enabler);
740
741struct req_vec_problem *
742 action_enabler_suggest_repair_oblig(const struct action_enabler *enabler);
743struct req_vec_problem *
744 action_enabler_suggest_repair(const struct action_enabler *enabler);
745struct req_vec_problem *
746 action_enabler_suggest_improvement(const struct action_enabler *enabler);
747
748 req_vec_num_in_item
749 action_enabler_vector_number(const void *enabler,
750 const struct requirement_vector *vec);
751struct requirement_vector *
752 action_enabler_vector_by_number(const void *enabler,
753 req_vec_num_in_item vec);
754const char *action_enabler_vector_by_number_name(req_vec_num_in_item vec);
755
756bool action_enabler_utype_possible_actor(const struct action_enabler *ae,
757 const struct unit_type *act_utype);
758bool action_enabler_possible_actor(const struct action_enabler *ae);
759
760struct action *action_is_blocked_by(const struct action *act,
761 const struct unit *actor_unit,
762 const struct tile *target_tile,
763 const struct city *target_city,
764 const struct unit *target_unit);
765
766bool is_action_enabled_unit_on_city(const struct civ_map *nmap,
767 const action_id wanted_action,
768 const struct unit *actor_unit,
769 const struct city *target_city);
770
771bool is_action_enabled_unit_on_unit(const struct civ_map *nmap,
772 const action_id wanted_action,
773 const struct unit *actor_unit,
774 const struct unit *target_unit);
775
776bool is_action_enabled_unit_on_stack(const struct civ_map *nmap,
777 const action_id wanted_action,
778 const struct unit *actor_unit,
779 const struct tile *target_tile);
780
781bool is_action_enabled_unit_on_tile(const struct civ_map *nmap,
782 const action_id wanted_action,
783 const struct unit *actor_unit,
784 const struct tile *target_tile,
785 const struct extra_type *target_extra);
786
787bool is_action_enabled_unit_on_extras(const action_id wanted_action,
788 const struct unit *actor_unit,
789 const struct tile *target,
790 const struct extra_type *tgt_extra);
791
792bool is_action_enabled_unit_on_self(const action_id wanted_action,
793 const struct unit *actor_unit);
794
795struct act_prob action_prob_vs_city(const struct unit* actor,
796 const action_id act_id,
797 const struct city* victim);
798
799struct act_prob action_prob_vs_unit(const struct unit* actor,
800 const action_id act_id,
801 const struct unit* victim);
802
803struct act_prob action_prob_vs_stack(const struct unit* actor,
804 const action_id act_id,
805 const struct tile* victims);
806
807struct act_prob action_prob_vs_tile(const struct unit *actor,
808 const action_id act_id,
809 const struct tile *victims,
810 const struct extra_type *target_extra);
811
812struct act_prob action_prob_vs_extras(const struct unit *actor,
813 const action_id act_id,
814 const struct tile *target,
815 const struct extra_type *tgt_extra);
816
817struct act_prob action_prob_self(const struct unit *actor,
818 const action_id act_id);
819
820struct act_prob action_prob_unit_vs_tgt(const struct action *paction,
821 const struct unit *act_unit,
822 const struct city *tgt_city,
823 const struct unit *tgt_unit,
824 const struct tile *tgt_tile,
825 const struct extra_type *sub_tgt);
826
827struct act_prob
828 action_speculate_unit_on_city(action_id act_id,
829 const struct unit *actor,
830 const struct city *actor_home,
831 const struct tile *actor_tile,
832 bool omniscient_cheat,
833 const struct city* target);
834
835struct act_prob
836 action_speculate_unit_on_unit(action_id act_id,
837 const struct unit *actor,
838 const struct city *actor_home,
839 const struct tile *actor_tile,
840 bool omniscient_cheat,
841 const struct unit *target);
842
843struct act_prob
844 action_speculate_unit_on_stack(action_id act_id,
845 const struct unit *actor,
846 const struct city *actor_home,
847 const struct tile *actor_tile,
848 bool omniscient_cheat,
849 const struct tile *target);
850
851struct act_prob
852 action_speculate_unit_on_tile(action_id act_id,
853 const struct unit *actor,
854 const struct city *actor_home,
855 const struct tile *actor_tile,
856 bool omniscient_cheat,
857 const struct tile *target_tile,
858 const struct extra_type *target_extra);
859
860struct act_prob
861 action_speculate_unit_on_extras(action_id act_id,
862 const struct unit *actor,
863 const struct city *actor_home,
864 const struct tile *actor_tile,
865 bool omniscient_cheat,
866 const struct tile *target_tile,
867 const struct extra_type *target_extra);
868
869struct act_prob
870 action_speculate_unit_on_self(action_id act_id,
871 const struct unit *actor,
872 const struct city *actor_home,
873 const struct tile *actor_tile,
874 bool omniscient_cheat);
875
876bool action_prob_possible(const struct act_prob probability);
877
878bool action_prob_certain(const struct act_prob probability);
879
880bool are_action_probabilitys_equal(const struct act_prob *ap1,
881 const struct act_prob *ap2);
882
883int action_prob_cmp_pessimist(const struct act_prob ap1,
884 const struct act_prob ap2);
885
886double action_prob_to_0_to_1_pessimist(const struct act_prob ap);
887
888struct act_prob action_prob_and(const struct act_prob *ap1,
889 const struct act_prob *ap2);
890
891struct act_prob action_prob_fall_back(const struct act_prob *ap1,
892 const struct act_prob *ap2);
893
894const char *action_prob_explain(const struct act_prob prob);
895
896struct act_prob action_prob_new_impossible(void);
897struct act_prob action_prob_new_not_relevant(void);
898struct act_prob action_prob_new_not_impl(void);
899struct act_prob action_prob_new_unknown(void);
900struct act_prob action_prob_new_certain(void);
901
902/* Special action probability values. Documented in fc_types.h's
903 * definition of struct act_prob. */
904#define ACTPROB_IMPOSSIBLE action_prob_new_impossible()
905#define ACTPROB_CERTAIN action_prob_new_certain()
906#define ACTPROB_NA action_prob_new_not_relevant()
907#define ACTPROB_NOT_IMPLEMENTED action_prob_new_not_impl()
908#define ACTPROB_NOT_KNOWN action_prob_new_unknown()
909
910/* ACTION_ODDS_PCT_DICE_ROLL_NA must be above 100%. */
911#define ACTION_ODDS_PCT_DICE_ROLL_NA 110
912int action_dice_roll_initial_odds(const struct action *paction);
913int action_dice_roll_odds(const struct player *act_player,
914 const struct unit *act_unit,
915 const struct city *tgt_city,
916 const struct player *tgt_player,
917 const struct action *paction);
918
919bool
920 action_actor_utype_hard_reqs_ok(const struct action *result,
921 const struct unit_type *actor_unittype);
922
923/* Reasoning about actions */
924bool action_univs_not_blocking(const struct action *paction,
925 struct universal *actor_uni,
926 struct universal *target_uni);
927#define action_id_univs_not_blocking(act_id, act_uni, tgt_uni) \
928 action_univs_not_blocking(action_by_number(act_id), act_uni, tgt_uni)
929
930bool action_immune_government(struct government *gov, action_id act);
931
932bool is_action_possible_on_city(action_id act_id,
933 const struct player *actor_player,
934 const struct city *target_city);
935
936bool action_maybe_possible_actor_unit(const struct civ_map *nmap,
937 const action_id wanted_action,
938 const struct unit *actor_unit);
939
940bool action_mp_full_makes_legal(const struct unit *actor,
941 const action_id act_id);
942
943bool action_is_in_use(struct action *paction);
944
945/* Action lists */
946void action_array_end(action_id *act_array, int size);
947void action_array_add_all_by_result(action_id *act_array,
948 int *position,
949 enum action_result result);
950
951/* Action auto performers */
952const struct action_auto_perf *action_auto_perf_by_number(const int num);
953struct action_auto_perf *action_auto_perf_slot_number(const int num);
954
955#ifdef __cplusplus
956}
957#endif /* __cplusplus */
958
959#endif /* FC_ACTIONS_H */
is_action_possible_on_city
bool is_action_possible_on_city(action_id act_id, const struct player *actor_player, const struct city *target_city)
Definition actions.c:6216
action_prob_vs_city
struct act_prob action_prob_vs_city(const struct unit *actor, const action_id act_id, const struct city *victim)
Definition actions.c:4981
action_prepare_ui_name
const char * action_prepare_ui_name(action_id act_id, const char *mnemonic, const struct act_prob prob, const char *custom)
Definition actions.c:2064
action_name_translation
const char * action_name_translation(const struct action *action)
Definition actions.c:1982
action_distance_inside_max
bool action_distance_inside_max(const struct action *action, const int distance)
Definition actions.c:1925
action_prob_explain
const char * action_prob_explain(const struct act_prob prob)
Definition actions.c:2175
action_mp_full_makes_legal
bool action_mp_full_makes_legal(const struct unit *actor, const action_id act_id)
Definition actions.c:6294
action_get_actor_kind
enum action_actor_kind action_get_actor_kind(const struct action *paction)
Definition actions.c:1850
action_prob_certain
bool action_prob_certain(const struct act_prob probability)
Definition actions.c:5833
action_id_name_translation
const char * action_id_name_translation(action_id act_id)
Definition actions.c:2002
action_auto_perf_slot_number
struct action_auto_perf * action_auto_perf_slot_number(const int num)
Definition actions.c:6423
action_enabler_vector_number
req_vec_num_in_item action_enabler_vector_number(const void *enabler, const struct requirement_vector *vec)
Definition actions.c:2800
action_has_complex_target
bool action_has_complex_target(const struct action *paction)
Definition actions.c:1884
action_prob_vs_extras
struct act_prob action_prob_vs_extras(const struct unit *actor, const action_id act_id, const struct tile *target, const struct extra_type *tgt_extra)
Definition actions.c:5426
action_enabler_suggest_repair
struct req_vec_problem * action_enabler_suggest_repair(const struct action_enabler *enabler)
Definition actions.c:2670
action_prob_possible
bool action_prob_possible(const struct act_prob probability)
Definition actions.c:5823
action_prob_new_not_impl
struct act_prob action_prob_new_not_impl(void)
Definition actions.c:5802
action_enabler_suggest_improvement
struct req_vec_problem * action_enabler_suggest_improvement(const struct action_enabler *enabler)
Definition actions.c:2736
actions_rs_pre_san_gen
void actions_rs_pre_san_gen(void)
Definition actions.c:1645
action_min_range_ruleset_var_name
const char * action_min_range_ruleset_var_name(int act)
Definition actions.c:7113
action_blocked_by_ruleset_var_name
const char * action_blocked_by_ruleset_var_name(const struct action *act)
Definition actions.c:7749
action_enabler_suggest_repair_oblig
struct req_vec_problem * action_enabler_suggest_repair_oblig(const struct action_enabler *enabler)
Definition actions.c:2430
action_array_add_all_by_result
void action_array_add_all_by_result(action_id *act_array, int *position, enum action_result result)
Definition actions.c:6488
action_dice_roll_odds
int action_dice_roll_odds(const struct player *act_player, const struct unit *act_unit, const struct city *tgt_city, const struct player *tgt_player, const struct action *paction)
Definition actions.c:6123
action_array_end
void action_array_end(action_id *act_array, int size)
Definition actions.c:6471
is_action_enabled_unit_on_self
bool is_action_enabled_unit_on_self(const action_id wanted_action, const struct unit *actor_unit)
Definition actions.c:4223
action_by_number
static struct action * action_by_number(action_id act_id)
Definition actions.h:633
action_maybe_possible_actor_unit
bool action_maybe_possible_actor_unit(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit)
Definition actions.c:6239
action_is_in_use
bool action_is_in_use(struct action *paction)
Definition actions.c:6400
action_prob_unit_vs_tgt
struct act_prob action_prob_unit_vs_tgt(const struct action *paction, const struct unit *act_unit, const struct city *tgt_city, const struct unit *tgt_unit, const struct tile *tgt_tile, const struct extra_type *sub_tgt)
Definition actions.c:5519
action_ever_possible
bool action_ever_possible(action_id action)
Definition actions.c:8081
action_prob_vs_unit
struct act_prob action_prob_vs_unit(const struct unit *actor, const action_id act_id, const struct unit *victim)
Definition actions.c:5065
action_enabler_vector_by_number_name
const char * action_enabler_vector_by_number_name(req_vec_num_in_item vec)
Definition actions.c:2847
are_action_probabilitys_equal
bool are_action_probabilitys_equal(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5874
action_post_success_forced_ruleset_var_name
const char * action_post_success_forced_ruleset_var_name(const struct action *act)
Definition actions.c:7923
action_by_rule_name
struct action * action_by_rule_name(const char *name)
Definition actions.c:1831
action_rule_name
const char * action_rule_name(const struct action *action)
Definition actions.c:1968
action_id_rule_name
const char * action_id_rule_name(action_id act_id)
Definition actions.c:1991
action_get_sub_target_kind
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Definition actions.c:1871
actions_free
void actions_free(void)
Definition actions.c:1655
action_enabler_free
void action_enabler_free(struct action_enabler *enabler)
Definition actions.c:2246
is_action_enabled_unit_on_stack
bool is_action_enabled_unit_on_stack(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct tile *target_tile)
Definition actions.c:3997
action_list_by_activity
struct action_list * action_list_by_activity(enum unit_activity activity)
Definition actions.c:8134
action_number
int action_number(const struct action *action)
Definition actions.c:1960
action_prob_new_unknown
struct act_prob action_prob_new_unknown(void)
Definition actions.c:5812
action_would_be_blocked_by
bool action_would_be_blocked_by(const struct action *blocked, const struct action *blocker)
Definition actions.c:1948
action_speculate_unit_on_self
struct act_prob action_speculate_unit_on_self(action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat)
Definition actions.c:5744
is_action_enabled_unit_on_tile
bool is_action_enabled_unit_on_tile(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct tile *target_tile, const struct extra_type *target_extra)
Definition actions.c:4073
action_prob_and
struct act_prob action_prob_and(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5961
action_actor_consuming_always_ruleset_var_name
const char * action_actor_consuming_always_ruleset_var_name(action_id act)
Definition actions.c:7593
action_immune_government
bool action_immune_government(struct government *gov, action_id act)
Definition actions.c:6175
action_prob_self
struct act_prob action_prob_self(const struct unit *actor, const action_id act_id)
Definition actions.c:5497
action_prob_new_certain
struct act_prob action_prob_new_certain(void)
Definition actions.c:5782
action_max_range_ruleset_var_name
const char * action_max_range_ruleset_var_name(int act)
Definition actions.c:7272
action_speculate_unit_on_stack
struct act_prob action_speculate_unit_on_stack(action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct tile *target)
Definition actions.c:5643
action_speculate_unit_on_city
struct act_prob action_speculate_unit_on_city(action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct city *target)
Definition actions.c:5575
action_dice_roll_initial_odds
int action_dice_roll_initial_odds(const struct action *paction)
Definition actions.c:6099
action_prob_fall_back
struct act_prob action_prob_fall_back(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:6031
action_is_blocked_by
struct action * action_is_blocked_by(const struct action *act, const struct unit *actor_unit, const struct tile *target_tile, const struct city *target_city, const struct unit *target_unit)
Definition actions.c:3027
action_speculate_unit_on_extras
struct act_prob action_speculate_unit_on_extras(action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct tile *target_tile, const struct extra_type *target_extra)
Definition actions.c:5710
is_action_enabled_unit_on_city
bool is_action_enabled_unit_on_city(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct city *target_city)
Definition actions.c:3832
action_prob_vs_stack
struct act_prob action_prob_vs_stack(const struct unit *actor, const action_id act_id, const struct tile *victims)
Definition actions.c:5258
action_list_by_result
struct action_list * action_list_by_result(enum action_result result)
Definition actions.c:8124
MAX_NUM_ACTIONS
#define MAX_NUM_ACTIONS
Definition actions.h:312
action_univs_not_blocking
bool action_univs_not_blocking(const struct action *paction, struct universal *actor_uni, struct universal *target_uni)
Definition actions.c:6447
actions_are_ready
bool actions_are_ready(void)
Definition actions.c:1708
is_action_enabled_unit_on_unit
bool is_action_enabled_unit_on_unit(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct unit *target_unit)
Definition actions.c:3909
action_actor_utype_hard_reqs_ok
bool action_actor_utype_hard_reqs_ok(const struct action *result, const struct unit_type *actor_unittype)
Definition actions.c:3347
action_target_kind_ruleset_var_name
const char * action_target_kind_ruleset_var_name(int act)
Definition actions.c:7439
action_enabler_add
void action_enabler_add(struct action_enabler *enabler)
Definition actions.c:2273
action_ui_name_default
const char * action_ui_name_default(int act)
Definition actions.c:6773
action_enabler_utype_possible_actor
bool action_enabler_utype_possible_actor(const struct action_enabler *ae, const struct unit_type *act_utype)
Definition actions.c:6317
action_enabler_new
struct action_enabler * action_enabler_new(void)
Definition actions.c:2227
action_requires_details
bool action_requires_details(const struct action *paction)
Definition actions.c:1897
action_prob_new_not_relevant
struct act_prob action_prob_new_not_relevant(void)
Definition actions.c:5792
action_target_kind_help
const char * action_target_kind_help(enum action_target_kind kind)
Definition actions.c:8114
action_get_role
int action_get_role(const struct action *paction)
Definition actions.c:2215
action_speculate_unit_on_unit
struct act_prob action_speculate_unit_on_unit(action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct unit *target)
Definition actions.c:5610
action_auto_perf_by_number
const struct action_auto_perf * action_auto_perf_by_number(const int num)
Definition actions.c:6439
action_prob_new_impossible
struct act_prob action_prob_new_impossible(void)
Definition actions.c:5772
action_enabler_possible_actor
bool action_enabler_possible_actor(const struct action_enabler *ae)
Definition actions.c:6344
_actions
struct action ** _actions
Definition actions.c:98
action_prob_vs_tile
struct act_prob action_prob_vs_tile(const struct unit *actor, const action_id act_id, const struct tile *victims, const struct extra_type *target_extra)
Definition actions.c:5342
action_id_exists
bool action_id_exists(const action_id act_id)
Definition actions.c:1820
action_enabler_remove
bool action_enabler_remove(struct action_enabler *enabler)
Definition actions.c:2290
action_get_target_kind
enum action_target_kind action_get_target_kind(const struct action *paction)
Definition actions.c:1860
action_enabler_copy
struct action_enabler * action_enabler_copy(const struct action_enabler *original)
Definition actions.c:2258
action_prob_cmp_pessimist
int action_prob_cmp_pessimist(const struct act_prob ap1, const struct act_prob ap2)
Definition actions.c:5883
action_id_is_rare_pop_up
bool action_id_is_rare_pop_up(action_id act_id)
Definition actions.c:1912
actions_init
void actions_init(void)
Definition actions.c:1585
action_speculate_unit_on_tile
struct act_prob action_speculate_unit_on_tile(action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct tile *target_tile, const struct extra_type *target_extra)
Definition actions.c:5676
action_enabler_vector_by_number
struct requirement_vector * action_enabler_vector_by_number(const void *enabler, req_vec_num_in_item vec)
Definition actions.c:2823
action_prob_to_0_to_1_pessimist
double action_prob_to_0_to_1_pessimist(const struct act_prob ap)
Definition actions.c:5934
gen_action_name_update_cb
const char * gen_action_name_update_cb(const char *old_name)
Definition actions.c:8089
action_enablers_for_action
struct action_enabler_list * action_enablers_for_action(action_id action)
Definition actions.c:2306
is_action_enabled_unit_on_extras
bool is_action_enabled_unit_on_extras(const action_id wanted_action, const struct unit *actor_unit, const struct tile *target, const struct extra_type *tgt_extra)
Definition actions.c:4150
action_distance_accepted
bool action_distance_accepted(const struct action *action, const int distance)
Definition actions.c:1936
action_ui_name_ruleset_var_name
const char * action_ui_name_ruleset_var_name(int act)
Definition actions.c:6508
action_get_ui_name_mnemonic
const char * action_get_ui_name_mnemonic(action_id act_id, const char *mnemonic)
Definition actions.c:2010
actres.h
incite_cost
char * incite_cost
Definition comments.c:74
target_unit
struct unit struct city struct unit * target_unit
Definition dialogs_g.h:56
actor_unit
struct unit * actor_unit
Definition dialogs_g.h:55
actor
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit * actor
Definition dialogs_g.h:73
target_tile
struct unit struct city struct unit struct tile * target_tile
Definition dialogs_g.h:57
target_city
struct unit struct city * target_city
Definition dialogs_g.h:56
target_extra
struct unit struct city struct unit struct tile struct extra_type * target_extra
Definition dialogs_g.h:57
fc_types.h
action_id
int action_id
Definition fc_types.h:392
MAX_LEN_NAME
#define MAX_LEN_NAME
Definition fc_types.h:66
name
const char * name
Definition inputfile.c:127
map_types.h
requirements.h
req_vec_num_in_item
signed char req_vec_num_in_item
req_vec_num_in_item a requirement vectors number in an item.
Definition requirements.h:237
specenum_gen.h
speclist.h
size
size_t size
Definition specvec.h:72
act_prob
Definition fc_types.h:1241
action_auto_perf
Definition actions.h:559
action_auto_perf::reqs
struct requirement_vector reqs
Definition actions.h:565
action_auto_perf::cause
enum action_auto_perf_cause cause
Definition actions.h:561
action_auto_perf::alternatives
action_id alternatives[MAX_NUM_ACTIONS]
Definition actions.h:569
action_enabler
Definition actions.h:419
action_enabler::ruledit_disabled
bool ruledit_disabled
Definition actions.h:426
action_enabler::action
action_id action
Definition actions.h:420
action_enabler::actor_reqs
struct requirement_vector actor_reqs
Definition actions.h:421
action_enabler::target_reqs
struct requirement_vector target_reqs
Definition actions.h:422
action
Definition actions.h:360
action::unitwaittime_controlled
bool unitwaittime_controlled
Definition actions.h:409
action::id
action_id id
Definition actions.h:361
action::actor_consuming_always
bool actor_consuming_always
Definition actions.h:393
action::rare_pop_up
bool rare_pop_up
Definition actions.h:406
action::max_distance
int max_distance
Definition actions.h:376
action::quiet
bool quiet
Definition actions.h:383
action::sub_target_kind
enum action_sub_target_kind sub_target_kind
Definition actions.h:368
action::moves_actor
enum moves_actor_kind moves_actor
Definition actions.h:413
action::is_unit
struct action::@12::@13 is_unit
action::result
enum action_result result
Definition actions.h:363
action::ui_name
char ui_name[MAX_LEN_NAME]
Definition actions.h:379
action::sub_results
bv_action_sub_results sub_results
Definition actions.h:364
action::actor_kind
enum action_actor_kind actor_kind
Definition actions.h:366
action::target_complexity
enum act_tgt_compl target_complexity
Definition actions.h:371
action::blocked_by
bv_actions blocked_by
Definition actions.h:387
action::actor
union action::@12 actor
action::target_kind
enum action_target_kind target_kind
Definition actions.h:367
action::min_distance
int min_distance
Definition actions.h:376
city
Definition city.h:320
civ_map
Definition map_types.h:71
extra_type
Definition extras.h:88
government
Definition government.h:52
player
Definition player.h:247
req_vec_problem
Definition requirements.h:295
tile
Definition tile.h:50
unit_type
Definition unittype.h:500
unit
Definition unit.h:138
universal
Definition fc_types.h:901