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