Freeciv-3.3
Loading...
Searching...
No Matches
actions.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996-2013 - Freeciv Development Team
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifndef FC_ACTIONS_H
15#define FC_ACTIONS_H
16
17/* common */
18#include "actres.h"
19#include "fc_types.h"
20#include "map_types.h"
21#include "requirements.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif /* __cplusplus */
26
27/* If 'enum gen_action' has currently unused values that should
28 * not be used in 'switch - cases', put those cases here. E.g.:
29 *
30 *#define ASSERT_UNUSED_ACTION_CASES \
31 * case ACTION_UNUSED_1: \
32 * fc_assert_msg(FALSE, "ACTION_UNUSED_1"); \
33 * break; \
34 * case ACTION_UNUSED_2: \
35 * fc_assert_msg(FALSE, "ACTION_UNUSED_2"); \
36 * break;
37 */
38#define ASSERT_UNUSED_ACTION_CASES \
39
40
41#define SPECENUM_NAME action_actor_kind
42#define SPECENUM_VALUE0 AAK_UNIT
43#define SPECENUM_VALUE0NAME N_("a unit")
44#define SPECENUM_COUNT AAK_COUNT
45#include "specenum_gen.h"
46
47const char *gen_action_name_update_cb(const char *old_name);
48
49#include "actions_enums_gen.h"
50
51/* Fake action id used in searches to signal "any action at all". */
52#define ACTION_ANY ACTION_COUNT
53
54/* Fake action id used to signal the absence of any actions. */
55#define ACTION_NONE ACTION_COUNT
56
57/* Used in the network protocol. */
58#define MAX_NUM_ACTIONS ACTION_COUNT
59#define NUM_ACTIONS MAX_NUM_ACTIONS
60
61/* Describes how a unit successfully performing an action will move it. */
62#define SPECENUM_NAME moves_actor_kind
63#define SPECENUM_VALUE0 MAK_STAYS
64#define SPECENUM_VALUE0NAME N_("stays")
65#define SPECENUM_VALUE1 MAK_REGULAR
66#define SPECENUM_VALUE1NAME N_("regular")
67#define SPECENUM_VALUE2 MAK_TELEPORT
68#define SPECENUM_VALUE2NAME N_("teleport")
69#define SPECENUM_VALUE3 MAK_ESCAPE
70#define SPECENUM_VALUE3NAME N_("escape")
71#define SPECENUM_VALUE4 MAK_FORCED
72#define SPECENUM_VALUE4NAME N_("forced")
73#define SPECENUM_VALUE5 MAK_UNREPRESENTABLE
74#define SPECENUM_VALUE5NAME N_("unrepresentable")
75#include "specenum_gen.h"
76
77/* Who ordered the action to be performed? */
78#define SPECENUM_NAME action_requester
79/* The player ordered it directly. */
80#define SPECENUM_VALUE0 ACT_REQ_PLAYER
81#define SPECENUM_VALUE0NAME N_("the player")
82/* The game it self because the rules requires it. */
83#define SPECENUM_VALUE1 ACT_REQ_RULES
84#define SPECENUM_VALUE1NAME N_("the game rules")
85/* A server side autonomous agent working for the player. */
86#define SPECENUM_VALUE2 ACT_REQ_SS_AGENT
87#define SPECENUM_VALUE2NAME N_("a server agent")
88/* Number of action requesters. */
89#define SPECENUM_COUNT ACT_REQ_COUNT
90#include "specenum_gen.h"
91
92/* The last action distance value that is interpreted as an actual
93 * distance rather than as a signal value.
94 *
95 * It is specified literally rather than referring to MAP_DISTANCE_MAX
96 * because Freeciv-web's MAP_DISTANCE_MAX differs from the regular Freeciv
97 * server's MAP_DISTANCE_MAX. A static assertion in actions.c makes sure
98 * that it can cover the whole map. */
99#define ACTION_DISTANCE_LAST_NON_SIGNAL 128016
100/* No action max distance to target limit. */
101#define ACTION_DISTANCE_UNLIMITED (ACTION_DISTANCE_LAST_NON_SIGNAL + 1)
102/* No action max distance can be bigger than this. */
103#define ACTION_DISTANCE_MAX ACTION_DISTANCE_UNLIMITED
104
105struct action
106{
108
111
115
116 /* Sub target policy. */
118
119 /* Limits on the distance on the map between the actor and the target.
120 * The action is legal iff the distance is min_distance, max_distance or
121 * a value in between. */
123
124 /* The name of the action shown in the UI */
126
127 /* Suppress automatic help text generation about what enables and/or
128 * disables this action. */
129 bool quiet;
130
131 /* Actions that blocks this action. The action will be illegal if any
132 * bloking action is legal. */
134
135 /* Successfully performing this action will always consume the actor.
136 * Don't set this for actions that consumes the unit in some cases
137 * (depending on luck, the presence of a flag, etc) but not in other
138 * cases. */
140
141 union {
142 struct {
143 /* A unit's ability to perform this action will pop up the action
144 * selection dialog before the player asks for it only in exceptional
145 * cases.
146 *
147 * The motivation for setting rare_pop_up is to minimize player
148 * annoyance and mistakes. Getting a pop up every time a unit moves is
149 * annoying. An unexpected offer to do something that in many cases is
150 * destructive can lead the player's muscle memory to perform the
151 * wrong action. */
153
154 /* The unitwaittime setting blocks this action when done too soon. */
156
157 /* How successfully performing the specified action always will move
158 * the actor unit of the specified type. */
162};
163
165{
169
170 /* Only relevant for ruledit and other rulesave users. Indicates that
171 * this action enabler is deleted and shouldn't be saved. */
173};
174
175#define action_has_result(_act_, _res_) ((_act_)->result == (_res_))
176
177#define enabler_get_action(_enabler_) action_by_number(_enabler_->action)
178#define enabler_get_action_id(_enabler_) (_enabler_->action)
179
180#define SPECLIST_TAG action_enabler
181#define SPECLIST_TYPE struct action_enabler
182#include "speclist.h"
183#define action_enabler_list_iterate(action_enabler_list, aenabler) \
184 TYPED_LIST_ITERATE(struct action_enabler, action_enabler_list, aenabler)
185#define action_enabler_list_iterate_end LIST_ITERATE_END
186
187#define action_enabler_list_re_iterate(action_enabler_list, aenabler) \
188 action_enabler_list_iterate(action_enabler_list, aenabler) { \
189 if (!aenabler->ruledit_disabled) {
190
191#define action_enabler_list_re_iterate_end \
192 } \
193 } action_enabler_list_iterate_end
194
195#define action_iterate_all(_act_) \
196{ \
197 action_id _act_; \
198 for (_act_ = 0; _act_ < NUM_ACTIONS; _act_++) {
199
200#define action_iterate_all_end \
201 } \
202}
203
204/* Filter out unused action slots, in versions where those exist */
205#define action_iterate(_act_) \
206{ \
207 action_iterate_all(_act_) {
208
209#define action_iterate_end \
210 } action_iterate_all_end; \
211}
212
213/* Get 'struct action_id_list' and related functions: */
214#define SPECLIST_TAG action
215#define SPECLIST_TYPE struct action
216#include "speclist.h"
217
218#define action_list_iterate(_list_, _act_) \
219 TYPED_LIST_ITERATE(struct action, _list_, _act_)
220#define action_list_iterate_end LIST_ITERATE_END
221
224
225/* TODO: Turn this to an iteration over precalculated list */
226#define action_noninternal_iterate(_act_) \
227{ \
228 action_iterate(_act_) { \
229 if (!action_id_is_internal(_act_)) {
230
231#define action_noninternal_iterate_end \
232 } \
233 } action_iterate_end; \
234}
235
236#define action_by_result_iterate(_paction_, _result_) \
237{ \
238 action_list_iterate(action_list_by_result(_result_), _paction_) { \
239
240#define action_by_result_iterate_end \
241 } action_list_iterate_end; \
242}
243
244#define action_by_activity_iterate(_paction_, _activity_) \
245{ \
246 action_list_iterate(action_list_by_activity(_activity_), _paction_) {
247
248#define action_by_activity_iterate_end \
249 } action_list_iterate_end; \
250}
251
252#define action_array_iterate(_act_array_, _act_id_) \
253{ \
254 int _pos_; \
255 \
256 for (_pos_ = 0; _pos_ < NUM_ACTIONS; _pos_++) { \
257 const action_id _act_id_ = _act_array_[_pos_]; \
258 \
259 if (_act_id_ == ACTION_NONE) { \
260 /* No more actions in this list. */ \
261 break; \
262 }
263
264#define action_array_iterate_end \
265 } \
266}
267
268#define action_enablers_iterate(_enabler_) \
269{ \
270 action_iterate(_act_) { \
271 action_enabler_list_iterate( \
272 action_enablers_for_action(_act_), _enabler_) {
273
274#define action_enablers_iterate_end \
275 } action_enabler_list_iterate_end; \
276 } action_iterate_end; \
277}
278
279/* The reason why an action should be auto performed. */
280#define SPECENUM_NAME action_auto_perf_cause
281/* Can't pay the unit's upkeep. */
282/* (Can be triggered by food, shield or gold upkeep) */
283#define SPECENUM_VALUE0 AAPC_UNIT_UPKEEP
284#define SPECENUM_VALUE0NAME "Unit Upkeep"
285/* A unit moved to an adjacent tile (auto attack). */
286#define SPECENUM_VALUE1 AAPC_UNIT_MOVED_ADJ
287#define SPECENUM_VALUE1NAME "Moved Adjacent"
288/* An action was successfully performed and the (action specific) conditions
289 * for forcing a post action move are fulfilled. */
290#define SPECENUM_VALUE2 AAPC_POST_ACTION
291#define SPECENUM_VALUE2NAME "After Successful Action"
292/* The city that made the unit's current tile native is gone. Evaluated
293 * against an adjacent tile. */
294#define SPECENUM_VALUE3 AAPC_CITY_GONE
295#define SPECENUM_VALUE3NAME "City Gone"
296/* The unit's stack has been defeated and is scheduled for execution but the
297 * unit has the CanEscape unit type flag.
298 * Evaluated against an adjacent tile. */
299#define SPECENUM_VALUE4 AAPC_UNIT_STACK_DEATH
300#define SPECENUM_VALUE4NAME "Unit Stack Dead"
301/* Number of forced action auto performer causes. */
302#define SPECENUM_COUNT AAPC_COUNT
303#include "specenum_gen.h"
304
305/* An Action Auto Performer rule makes an actor try to perform an action
306 * without being ordered to do so by the player controlling it.
307 * - the first auto performer that matches the cause and fulfills the reqs
308 * is selected.
309 * - the actions listed by the selected auto performer is tried in order
310 * until an action is successful, all actions have been tried or the
311 * actor disappears.
312 * - if no action inside the selected auto performer is legal no action is
313 * performed. The system won't try to select another auto performer.
314 */
316{
317 /* The reason for trying to auto perform an action. */
319
320 /* Must be fulfilled if the game should try to force an action from this
321 * action auto performer. */
323
324 /* Auto perform the first legal action in this list.
325 * The list is terminated by ACTION_NONE. */
327};
328
329#define action_auto_perf_iterate(_act_perf_) \
330{ \
331 int _ap_num_; \
332 \
333 for (_ap_num_ = 0; \
334 _ap_num_ < MAX_NUM_ACTION_AUTO_PERFORMERS \
335 && (action_auto_perf_by_number(_ap_num_)->cause \
336 != AAPC_COUNT); \
337 _ap_num_++) { \
338 const struct action_auto_perf *_act_perf_ \
339 = action_auto_perf_by_number(_ap_num_);
340
341#define action_auto_perf_iterate_end \
342 } \
343}
344
345#define action_auto_perf_by_cause_iterate(_cause_, _act_perf_) \
346action_auto_perf_iterate(_act_perf_) { \
347 if (_act_perf_->cause != _cause_) { \
348 continue; \
349 }
350
351#define action_auto_perf_by_cause_iterate_end \
352} action_auto_perf_iterate_end
353
354#define action_auto_perf_actions_iterate(_autoperf_, _act_id_) \
355 action_array_iterate(_autoperf_->alternatives, _act_id_)
356
357#define action_auto_perf_actions_iterate_end \
358 action_array_iterate_end
359
360/* Hard coded location of action auto performers. Used for conversion while
361 * action auto performers aren't directly exposed to the ruleset.
362 * Remember to update also MAX_NUM_ACTION_AUTO_PERFORMERS when changing these. */
363#define ACTION_AUTO_UPKEEP_FOOD 0
364#define ACTION_AUTO_UPKEEP_GOLD 1
365#define ACTION_AUTO_UPKEEP_SHIELD 2
366#define ACTION_AUTO_MOVED_ADJ 3
367#define ACTION_AUTO_POST_BRIBE 4
368#define ACTION_AUTO_POST_ATTACK 5
369#define ACTION_AUTO_POST_ATTACK2 6
370#define ACTION_AUTO_POST_COLLECT_RANSOM 7
371#define ACTION_AUTO_ESCAPE_CITY 8
372#define ACTION_AUTO_ESCAPE_STACK 9
373#define ACTION_AUTO_POST_WIPE_UNITS 10
374
375/* Initialization */
376void actions_init(void);
377void actions_rs_pre_san_gen(void);
378void actions_free(void);
379
380bool actions_are_ready(void);
381
382bool action_id_exists(const action_id act_id);
383
384extern struct action **_actions;
385/**********************************************************************/
390static inline struct action *action_by_number(action_id act_id)
391{
392 if (!gen_action_is_valid((enum gen_action)act_id)) {
393 return NULL;
394 }
395
396 /* We return NULL if there's NULL there, no need to special case it */
397 return _actions[act_id];
398}
399
400struct action *action_by_rule_name(const char *name);
401
403#define action_id_get_actor_kind(act_id) \
404 action_get_actor_kind(action_by_number(act_id))
406 const struct action *paction);
407#define action_id_get_target_kind(act_id) \
408 action_get_target_kind(action_by_number(act_id))
410 const struct action *paction);
411#define action_id_get_sub_target_kind(act_id) \
412 action_get_sub_target_kind(action_by_number(act_id))
413
414int action_number(const struct action *action);
415
416#define action_id(_act_) (_act_->id)
417
418#define action_has_result_safe(paction, result) \
419 (paction && action_has_result(paction, result))
420#define action_id_has_result_safe(act_id, result) \
421 (action_by_number(act_id) \
422 && action_has_result(action_by_number(act_id), result))
423
424bool action_has_complex_target(const struct action *paction);
425#define action_id_has_complex_target(act_id) \
426 action_has_complex_target(action_by_number(act_id))
427bool action_requires_details(const struct action *paction);
428#define action_id_requires_details(act_id) \
429 action_requires_details(action_by_number(act_id))
430
431#define action_id_get_act_time(act_id, actor_unit, tgt_tile, tgt_extra) \
432 actres_get_act_time(action_by_number(act_id)->result, \
433 actor_unit, tgt_tile, tgt_extra)
434
436
437bool action_distance_accepted(const struct action *action,
438 const int distance);
439#define action_id_distance_accepted(act_id, distance) \
440 action_distance_accepted(action_by_number(act_id), distance)
441
442bool action_distance_inside_max(const struct action *action,
443 const int distance);
444#define action_id_distance_inside_max(act_id, distance) \
445 action_distance_inside_max(action_by_number(act_id), distance)
446
447bool action_would_be_blocked_by(const struct action *blocked,
448 const struct action *blocker);
449
450int action_get_role(const struct action *paction);
451#define action_id_get_role(act_id) \
452 action_get_role(action_by_number(act_id))
453
454#define action_get_activity(_pact_) \
455 actres_activity_result(_pact_->result)
456#define action_id_get_activity(act_id) \
457 action_get_activity(action_by_number(act_id))
458
459const char *action_rule_name(const struct action *action);
460const char *action_id_rule_name(action_id act_id);
461
462const char *action_name_translation(const struct action *paction);
463const char *action_id_name_translation(action_id act_id);
464const char *action_get_ui_name_mnemonic(action_id act_id,
465 const char *mnemonic);
466const char *action_prepare_ui_name(action_id act_id, const char *mnemonic,
467 const struct act_prob prob,
468 const char *custom);
469
470const char *action_ui_name_ruleset_var_name(int act);
471const char *action_ui_name_default(int act);
472
473const char *action_min_range_ruleset_var_name(int act);
474const char *action_max_range_ruleset_var_name(int act);
475
476const char *action_target_kind_ruleset_var_name(int act);
477const char *action_target_kind_help(enum action_target_kind kind);
478
480
481const char *action_blocked_by_ruleset_var_name(const struct action *act);
482
483const char *
485
487
488struct action_enabler_list *
490
493struct action_enabler *
494action_enabler_copy(const struct action_enabler *original);
497
498struct req_vec_problem *
500struct req_vec_problem *
502struct req_vec_problem *
504
507 const struct requirement_vector *vec);
508struct requirement_vector *
512
514 const struct unit_type *act_utype);
516
517struct action *action_is_blocked_by(const struct action *act,
518 const struct unit *actor_unit,
519 const struct tile *target_tile,
520 const struct city *target_city,
521 const struct unit *target_unit);
522
525 const struct unit *actor_unit,
526 const struct city *target_city);
527
530 const struct unit *actor_unit,
531 const struct unit *target_unit);
532
535 const struct unit *actor_unit,
536 const struct tile *target_tile);
537
540 const struct unit *actor_unit,
541 const struct tile *target_tile,
542 const struct extra_type *target_extra);
543
546 const struct unit *actor_unit,
547 const struct tile *target,
548 const struct extra_type *tgt_extra);
549
552 const struct unit *actor_unit);
553
555 const struct unit *actor,
556 const action_id act_id,
557 const struct city *victim);
558
560 const struct unit *actor,
561 const action_id act_id,
562 const struct unit *victim);
563
565 const action_id act_id,
566 const struct tile* victims);
567
569 const action_id act_id,
570 const struct tile *victims,
571 const struct extra_type *target_extra);
572
574 const action_id act_id,
575 const struct tile *target,
576 const struct extra_type *tgt_extra);
577
579 const action_id act_id);
580
582 const struct unit *act_unit,
583 const struct city *tgt_city,
584 const struct unit *tgt_unit,
585 const struct tile *tgt_tile,
586 const struct extra_type *sub_tgt);
587
588struct act_prob
591 const struct city *actor_home,
592 const struct tile *actor_tile,
593 bool omniscient_cheat,
594 const struct city* target);
595
596struct act_prob
599 const struct city *actor_home,
600 const struct tile *actor_tile,
601 bool omniscient_cheat,
602 const struct unit *target);
603
604struct act_prob
607 const struct city *actor_home,
608 const struct tile *actor_tile,
609 bool omniscient_cheat,
610 const struct tile *target);
611
612struct act_prob
615 const struct city *actor_home,
616 const struct tile *actor_tile,
617 bool omniscient_cheat,
618 const struct tile *target_tile,
619 const struct extra_type *target_extra);
620
621struct act_prob
624 const struct city *actor_home,
625 const struct tile *actor_tile,
626 bool omniscient_cheat,
627 const struct tile *target_tile,
628 const struct extra_type *target_extra);
629
630struct act_prob
633 const struct city *actor_home,
634 const struct tile *actor_tile,
635 bool omniscient_cheat);
636
637bool action_prob_possible(const struct act_prob probability);
638
639bool action_prob_certain(const struct act_prob probability);
640
642 const struct act_prob *ap2);
643
644int action_prob_cmp_pessimist(const struct act_prob ap1,
645 const struct act_prob ap2);
646
647double action_prob_to_0_to_1_pessimist(const struct act_prob ap);
648
650 const struct act_prob *ap2);
651
653 const struct act_prob *ap2);
654
655const char *action_prob_explain(const struct act_prob prob);
656
662
663/* Special action probability values. Documented in fc_types.h's
664 * definition of struct act_prob. */
665#define ACTPROB_IMPOSSIBLE action_prob_new_impossible()
666#define ACTPROB_CERTAIN action_prob_new_certain()
667#define ACTPROB_NA action_prob_new_not_relevant()
668#define ACTPROB_NOT_IMPLEMENTED action_prob_new_not_impl()
669#define ACTPROB_NOT_KNOWN action_prob_new_unknown()
670
671/* ACTION_ODDS_PCT_DICE_ROLL_NA must be above 100%. */
672#define ACTION_ODDS_PCT_DICE_ROLL_NA 110
674int action_dice_roll_odds(const struct player *act_player,
675 const struct unit *act_unit,
676 const struct city *tgt_city,
677 const struct player *tgt_player,
678 const struct action *paction);
679
680bool
681action_actor_utype_hard_reqs_ok(const struct action *result,
682 const struct unit_type *actor_unittype);
683
684/* Reasoning about actions */
685bool action_univs_not_blocking(const struct action *paction,
686 struct universal *actor_uni,
687 struct universal *target_uni);
688#define action_id_univs_not_blocking(act_id, act_uni, tgt_uni) \
689 action_univs_not_blocking(action_by_number(act_id), act_uni, tgt_uni)
690
691bool action_immune_government(struct government *gov, action_id act);
692
694 const struct player *actor_player,
695 const struct city *target_city);
696
699 const struct unit *actor_unit);
700
701bool action_mp_full_makes_legal(const struct unit *actor,
702 const action_id act_id);
703
704bool action_is_in_use(struct action *paction);
705
706bool action_is_internal(struct action *paction);
708
709/* Action lists */
712 int *position,
713 enum action_result result);
714
715/* Action auto performers */
716const struct action_auto_perf *action_auto_perf_by_number(const int num);
718
719#ifdef __cplusplus
720}
721#endif /* __cplusplus */
722
723#endif /* FC_ACTIONS_H */
bool is_action_possible_on_city(action_id act_id, const struct player *actor_player, const struct city *target_city)
Definition actions.c:5444
const char * action_prepare_ui_name(action_id act_id, const char *mnemonic, const struct act_prob prob, const char *custom)
Definition actions.c:1287
bool action_distance_inside_max(const struct action *action, const int distance)
Definition actions.c:1148
const char * action_prob_explain(const struct act_prob prob)
Definition actions.c:1398
bool action_mp_full_makes_legal(const struct unit *actor, const action_id act_id)
Definition actions.c:5522
enum action_actor_kind action_get_actor_kind(const struct action *paction)
Definition actions.c:1073
bool action_prob_certain(const struct act_prob probability)
Definition actions.c:5054
const char * action_id_name_translation(action_id act_id)
Definition actions.c:1225
struct action_auto_perf * action_auto_perf_slot_number(const int num)
Definition actions.c:5675
req_vec_num_in_item action_enabler_vector_number(const void *enabler, const struct requirement_vector *vec)
Definition actions.c:2022
bool action_has_complex_target(const struct action *paction)
Definition actions.c:1107
struct act_prob action_prob_vs_extras(const struct unit *actor, const action_id act_id, const struct tile *target, const struct extra_type *tgt_extra)
Definition actions.c:4646
struct req_vec_problem * action_enabler_suggest_repair(const struct action_enabler *enabler)
Definition actions.c:1892
bool action_prob_possible(const struct act_prob probability)
Definition actions.c:5044
struct act_prob action_prob_new_not_impl(void)
Definition actions.c:5023
struct req_vec_problem * action_enabler_suggest_improvement(const struct action_enabler *enabler)
Definition actions.c:1958
void actions_rs_pre_san_gen(void)
Definition actions.c:879
const char * action_min_range_ruleset_var_name(int act)
Definition actions.c:6414
const char * action_blocked_by_ruleset_var_name(const struct action *act)
Definition actions.c:7116
struct req_vec_problem * action_enabler_suggest_repair_oblig(const struct action_enabler *enabler)
Definition actions.c:1653
void action_array_add_all_by_result(action_id *act_array, int *position, enum action_result result)
Definition actions.c:5740
const char * action_name_translation(const struct action *paction)
Definition actions.c:1205
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:5344
void action_array_end(action_id *act_array, int size)
Definition actions.c:5723
static struct action * action_by_number(action_id act_id)
Definition actions.h:390
bool action_maybe_possible_actor_unit(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit)
Definition actions.c:5467
bool action_is_in_use(struct action *paction)
Definition actions.c:5629
struct act_prob action_prob_unit_vs_tgt(const struct action *paction, const struct unit *act_unit, const struct city *tgt_city, const struct unit *tgt_unit, const struct tile *tgt_tile, const struct extra_type *sub_tgt)
Definition actions.c:4739
bool action_ever_possible(action_id action)
Definition actions.c:7481
const char * action_enabler_vector_by_number_name(req_vec_num_in_item vec)
Definition actions.c:2069
bool are_action_probabilitys_equal(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5095
const char * action_post_success_forced_ruleset_var_name(const struct action *act)
Definition actions.c:7308
struct action * action_by_rule_name(const char *name)
Definition actions.c:1054
const char * action_rule_name(const struct action *action)
Definition actions.c:1191
const char * action_id_rule_name(action_id act_id)
Definition actions.c:1214
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Definition actions.c:1094
void actions_free(void)
Definition actions.c:889
void action_enabler_free(struct action_enabler *enabler)
Definition actions.c:1469
bool is_action_enabled_unit_on_stack(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct tile *target_tile)
Definition actions.c:3217
struct action_list * action_list_by_activity(enum unit_activity activity)
Definition actions.c:7535
int action_number(const struct action *action)
Definition actions.c:1183
struct act_prob action_prob_new_unknown(void)
Definition actions.c:5033
bool action_would_be_blocked_by(const struct action *blocked, const struct action *blocker)
Definition actions.c:1171
struct act_prob action_speculate_unit_on_self(action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat)
Definition actions.c:4965
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:3293
struct act_prob action_prob_and(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5182
const char * action_actor_consuming_always_ruleset_var_name(action_id act)
Definition actions.c:6945
bool action_immune_government(struct government *gov, action_id act)
Definition actions.c:5400
struct act_prob action_prob_self(const struct unit *actor, const action_id act_id)
Definition actions.c:4717
struct act_prob action_prob_new_certain(void)
Definition actions.c:5003
const char * action_max_range_ruleset_var_name(int act)
Definition actions.c:6590
struct act_prob action_speculate_unit_on_stack(action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct tile *target)
Definition actions.c:4864
bool action_is_internal(struct action *paction)
Definition actions.c:5655
struct act_prob action_speculate_unit_on_city(action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct city *target)
Definition actions.c:4796
int action_dice_roll_initial_odds(const struct action *paction)
Definition actions.c:5320
struct act_prob action_prob_fall_back(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5252
struct action * action_is_blocked_by(const struct action *act, const struct unit *actor_unit, const struct tile *target_tile, const struct city *target_city, const struct unit *target_unit)
Definition actions.c:2249
struct act_prob action_speculate_unit_on_extras(action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct tile *target_tile, const struct extra_type *target_extra)
Definition actions.c:4931
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:3052
struct act_prob action_prob_vs_stack(const struct unit *actor, const action_id act_id, const struct tile *victims)
Definition actions.c:4478
struct action_list * action_list_by_result(enum action_result result)
Definition actions.c:7525
#define MAX_NUM_ACTIONS
Definition actions.h:58
bool action_univs_not_blocking(const struct action *paction, struct universal *actor_uni, struct universal *target_uni)
Definition actions.c:5699
bool actions_are_ready(void)
Definition actions.c:931
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:3129
bool action_actor_utype_hard_reqs_ok(const struct action *result, const struct unit_type *actor_unittype)
Definition actions.c:2569
const char * action_target_kind_ruleset_var_name(int act)
Definition actions.c:6775
void action_enabler_add(struct action_enabler *enabler)
Definition actions.c:1496
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:4286
const char * action_ui_name_default(int act)
Definition actions.c:6055
bool action_enabler_utype_possible_actor(const struct action_enabler *ae, const struct unit_type *act_utype)
Definition actions.c:5545
struct action_enabler * action_enabler_new(void)
Definition actions.c:1450
bool action_requires_details(const struct action *paction)
Definition actions.c:1120
struct act_prob action_prob_new_not_relevant(void)
Definition actions.c:5013
const char * action_target_kind_help(enum action_target_kind kind)
Definition actions.c:7515
int action_get_role(const struct action *paction)
Definition actions.c:1438
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:4203
struct act_prob action_speculate_unit_on_unit(action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct unit *target)
Definition actions.c:4831
const struct action_auto_perf * action_auto_perf_by_number(const int num)
Definition actions.c:5691
struct act_prob action_prob_new_impossible(void)
Definition actions.c:4993
bool action_enabler_possible_actor(const struct action_enabler *ae)
Definition actions.c:5572
struct action ** _actions
Definition actions.c:58
struct act_prob action_prob_vs_tile(const struct unit *actor, const action_id act_id, const struct tile *victims, const struct extra_type *target_extra)
Definition actions.c:4562
bool action_id_exists(const action_id act_id)
Definition actions.c:1043
bool action_enabler_remove(struct action_enabler *enabler)
Definition actions.c:1513
enum action_target_kind action_get_target_kind(const struct action *paction)
Definition actions.c:1083
struct action_enabler * action_enabler_copy(const struct action_enabler *original)
Definition actions.c:1481
int action_prob_cmp_pessimist(const struct act_prob ap1, const struct act_prob ap2)
Definition actions.c:5104
bool action_id_is_internal(action_id act)
Definition actions.c:5667
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:3442
bool action_id_is_rare_pop_up(action_id act_id)
Definition actions.c:1135
void actions_init(void)
Definition actions.c:830
struct act_prob action_speculate_unit_on_tile(action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct tile *target_tile, const struct extra_type *target_extra)
Definition actions.c:4897
struct requirement_vector * action_enabler_vector_by_number(const void *enabler, req_vec_num_in_item vec)
Definition actions.c:2045
double action_prob_to_0_to_1_pessimist(const struct act_prob ap)
Definition actions.c:5155
const char * gen_action_name_update_cb(const char *old_name)
Definition actions.c:7489
struct action_enabler_list * action_enablers_for_action(action_id action)
Definition actions.c:1529
bool action_distance_accepted(const struct action *action, const int distance)
Definition actions.c:1159
const char * action_ui_name_ruleset_var_name(int act)
Definition actions.c:5760
const char * action_get_ui_name_mnemonic(action_id act_id, const char *mnemonic)
Definition actions.c:1233
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:3370
char * incite_cost
Definition comments.c:74
struct unit struct city struct unit * target_unit
Definition dialogs_g.h:56
struct unit * actor_unit
Definition dialogs_g.h:55
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit * actor
Definition dialogs_g.h:73
struct unit struct city struct unit struct tile * target_tile
Definition dialogs_g.h:57
struct unit struct city * target_city
Definition dialogs_g.h:56
struct unit struct city struct unit struct tile struct extra_type * target_extra
Definition dialogs_g.h:57
int action_id
Definition fc_types.h:393
#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:322
enum action_auto_perf_cause cause
Definition actions.h:318
action_id alternatives[MAX_NUM_ACTIONS]
Definition actions.h:326
bool ruledit_disabled
Definition actions.h:172
action_id action
Definition actions.h:166
struct requirement_vector actor_reqs
Definition actions.h:167
struct requirement_vector target_reqs
Definition actions.h:168
bool unitwaittime_controlled
Definition actions.h:155
action_id id
Definition actions.h:107
bool actor_consuming_always
Definition actions.h:139
bool rare_pop_up
Definition actions.h:152
int max_distance
Definition actions.h:122
bool quiet
Definition actions.h:129
enum action_sub_target_kind sub_target_kind
Definition actions.h:114
enum moves_actor_kind moves_actor
Definition actions.h:159
struct action::@12::@13 is_unit
enum action_result result
Definition actions.h:109
char ui_name[MAX_LEN_NAME]
Definition actions.h:125
bv_action_sub_results sub_results
Definition actions.h:110
enum action_actor_kind actor_kind
Definition actions.h:112
enum act_tgt_compl target_complexity
Definition actions.h:117
bv_actions blocked_by
Definition actions.h:133
union action::@12 actor
enum action_target_kind target_kind
Definition actions.h:113
int min_distance
Definition actions.h:122
Definition city.h:320
Definition tile.h:50
Definition unit.h:140