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