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{
109
112
116
117 /* Sub target policy. */
119
120 /* Limits on the distance on the map between the actor and the target.
121 * The action is legal iff the distance is min_distance, max_distance or
122 * a value in between. */
124
125 /* The name of the action shown in the UI */
127
128 /* Suppress automatic help text generation about what enables and/or
129 * disables this action. */
130 bool quiet;
131
132 /* Actions that blocks this action. The action will be illegal if any
133 * bloking action is legal. */
135
136 /* Successfully performing this action will always consume the actor.
137 * Don't set this for actions that consumes the unit in some cases
138 * (depending on luck, the presence of a flag, etc) but not in other
139 * cases. */
141
142 union {
143 struct {
144 /* A unit's ability to perform this action will pop up the action
145 * selection dialog before the player asks for it only in exceptional
146 * cases.
147 *
148 * The motivation for setting rare_pop_up is to minimize player
149 * annoyance and mistakes. Getting a pop up every time a unit moves is
150 * annoying. An unexpected offer to do something that in many cases is
151 * destructive can lead the player's muscle memory to perform the
152 * wrong action. */
154
155 /* The unitwaittime setting blocks this action when done too soon. */
157
158 /* How successfully performing the specified action always will move
159 * the actor unit of the specified type. */
163};
164
166{
170
171 struct {
172 /* Only relevant for ruledit and other rulesave users. Indicates that
173 * this action enabler is deleted and shouldn't be saved. */
175
176 char *comment;
178};
179
180#define action_has_result(_act_, _res_) ((_act_)->result == (_res_))
181
182#define enabler_get_action(_enabler_) action_by_number(_enabler_->action)
183#define enabler_get_action_id(_enabler_) (_enabler_->action)
184
185#define SPECLIST_TAG action_enabler
186#define SPECLIST_TYPE struct action_enabler
187#include "speclist.h"
188#define action_enabler_list_iterate(action_enabler_list, aenabler) \
189 TYPED_LIST_ITERATE(struct action_enabler, action_enabler_list, aenabler)
190#define action_enabler_list_iterate_end LIST_ITERATE_END
191
192#define action_enabler_list_re_iterate(action_enabler_list, aenabler) \
193 action_enabler_list_iterate(action_enabler_list, aenabler) { \
194 if (!aenabler->rulesave.ruledit_disabled) {
195
196#define action_enabler_list_re_iterate_end \
197 } \
198 } action_enabler_list_iterate_end
199
200#define action_iterate_all(_act_) \
201{ \
202 action_id _act_; \
203 for (_act_ = 0; _act_ < NUM_ACTIONS; _act_++) {
204
205#define action_iterate_all_end \
206 } \
207}
208
209/* Filter out unused action slots, in versions where those exist */
210#define action_iterate(_act_) \
211{ \
212 action_iterate_all(_act_) {
213
214#define action_iterate_end \
215 } action_iterate_all_end; \
216}
217
218/* Get 'struct action_id_list' and related functions: */
219#define SPECLIST_TAG action
220#define SPECLIST_TYPE struct action
221#include "speclist.h"
222
223#define action_list_iterate(_list_, _act_) \
224 TYPED_LIST_ITERATE(struct action, _list_, _act_)
225#define action_list_iterate_end LIST_ITERATE_END
226
229
230/* TODO: Turn this to an iteration over precalculated list */
231#define action_noninternal_iterate(_act_) \
232{ \
233 action_iterate(_act_) { \
234 if (!action_id_is_internal(_act_)) {
235
236#define action_noninternal_iterate_end \
237 } \
238 } action_iterate_end; \
239}
240
241#define action_by_result_iterate(_paction_, _result_) \
242{ \
243 action_list_iterate(action_list_by_result(_result_), _paction_) { \
244
245#define action_by_result_iterate_end \
246 } action_list_iterate_end; \
247}
248
249#define action_by_activity_iterate(_paction_, _activity_) \
250{ \
251 action_list_iterate(action_list_by_activity(_activity_), _paction_) {
252
253#define action_by_activity_iterate_end \
254 } action_list_iterate_end; \
255}
256
257#define action_array_iterate(_act_array_, _act_id_) \
258{ \
259 int _pos_; \
260 \
261 for (_pos_ = 0; _pos_ < NUM_ACTIONS; _pos_++) { \
262 const action_id _act_id_ = _act_array_[_pos_]; \
263 \
264 if (_act_id_ == ACTION_NONE) { \
265 /* No more actions in this list. */ \
266 break; \
267 }
268
269#define action_array_iterate_end \
270 } \
271}
272
273#define action_enablers_iterate(_enabler_) \
274{ \
275 action_iterate(_act_) { \
276 action_enabler_list_iterate( \
277 action_enablers_for_action(_act_), _enabler_) {
278
279#define action_enablers_iterate_end \
280 } action_enabler_list_iterate_end; \
281 } action_iterate_end; \
282}
283
284/* The reason why an action should be auto performed. */
285#define SPECENUM_NAME action_auto_perf_cause
286/* Can't pay the unit's upkeep. */
287/* (Can be triggered by food, shield or gold upkeep) */
288#define SPECENUM_VALUE0 AAPC_UNIT_UPKEEP
289#define SPECENUM_VALUE0NAME "Unit Upkeep"
290/* A unit moved to an adjacent tile (auto attack). */
291#define SPECENUM_VALUE1 AAPC_UNIT_MOVED_ADJ
292#define SPECENUM_VALUE1NAME "Moved Adjacent"
293/* An action was successfully performed and the (action specific) conditions
294 * for forcing a post action move are fulfilled. */
295#define SPECENUM_VALUE2 AAPC_POST_ACTION
296#define SPECENUM_VALUE2NAME "After Successful Action"
297/* The city that made the unit's current tile native is gone. Evaluated
298 * against an adjacent tile. */
299#define SPECENUM_VALUE3 AAPC_CITY_GONE
300#define SPECENUM_VALUE3NAME "City Gone"
301/* The unit's stack has been defeated and is scheduled for execution but the
302 * unit has the CanEscape unit type flag.
303 * Evaluated against an adjacent tile. */
304#define SPECENUM_VALUE4 AAPC_UNIT_STACK_DEATH
305#define SPECENUM_VALUE4NAME "Unit Stack Dead"
306/* Number of forced action auto performer causes. */
307#define SPECENUM_COUNT AAPC_COUNT
308#include "specenum_gen.h"
309
310/* An Action Auto Performer rule makes an actor try to perform an action
311 * without being ordered to do so by the player controlling it.
312 * - the first auto performer that matches the cause and fulfills the reqs
313 * is selected.
314 * - the actions listed by the selected auto performer is tried in order
315 * until an action is successful, all actions have been tried or the
316 * actor disappears.
317 * - if no action inside the selected auto performer is legal no action is
318 * performed. The system won't try to select another auto performer.
319 */
321{
322 /* The reason for trying to auto perform an action. */
324
325 /* Must be fulfilled if the game should try to force an action from this
326 * action auto performer. */
328
329 /* Auto perform the first legal action in this list.
330 * The list is terminated by ACTION_NONE. */
332};
333
334#define action_auto_perf_iterate(_act_perf_) \
335{ \
336 int _ap_num_; \
337 \
338 for (_ap_num_ = 0; \
339 _ap_num_ < MAX_NUM_ACTION_AUTO_PERFORMERS \
340 && (action_auto_perf_by_number(_ap_num_)->cause \
341 != AAPC_COUNT); \
342 _ap_num_++) { \
343 const struct action_auto_perf *_act_perf_ \
344 = action_auto_perf_by_number(_ap_num_);
345
346#define action_auto_perf_iterate_end \
347 } \
348}
349
350#define action_auto_perf_by_cause_iterate(_cause_, _act_perf_) \
351action_auto_perf_iterate(_act_perf_) { \
352 if (_act_perf_->cause != _cause_) { \
353 continue; \
354 }
355
356#define action_auto_perf_by_cause_iterate_end \
357} action_auto_perf_iterate_end
358
359#define action_auto_perf_actions_iterate(_autoperf_, _act_id_) \
360 action_array_iterate(_autoperf_->alternatives, _act_id_)
361
362#define action_auto_perf_actions_iterate_end \
363 action_array_iterate_end
364
365/* Hard coded location of action auto performers. Used for conversion while
366 * action auto performers aren't directly exposed to the ruleset.
367 * Remember to update also MAX_NUM_ACTION_AUTO_PERFORMERS when changing these. */
368#define ACTION_AUTO_UPKEEP_FOOD 0
369#define ACTION_AUTO_UPKEEP_GOLD 1
370#define ACTION_AUTO_UPKEEP_SHIELD 2
371#define ACTION_AUTO_MOVED_ADJ 3
372#define ACTION_AUTO_POST_BRIBE_UNIT 4
373#define ACTION_AUTO_POST_BRIBE_STACK 5
374#define ACTION_AUTO_POST_ATTACK 6
375#define ACTION_AUTO_POST_ATTACK2 7
376#define ACTION_AUTO_POST_COLLECT_RANSOM 8
377#define ACTION_AUTO_ESCAPE_CITY 9
378#define ACTION_AUTO_ESCAPE_STACK 10
379#define ACTION_AUTO_POST_WIPE_UNITS 11
380
381/* Initialization */
382void actions_init(void);
383void actions_rs_pre_san_gen(void);
384void actions_free(void);
385
386bool actions_are_ready(void);
387
388bool action_id_exists(const action_id act_id);
389
390extern struct action **_actions;
391/**********************************************************************/
396static inline struct action *action_by_number(action_id act_id)
397{
398 if (!gen_action_is_valid((enum gen_action)act_id)) {
399 return NULL;
400 }
401
402 /* We return NULL if there's NULL there, no need to special case it */
403 return _actions[act_id];
404}
405
406struct action *action_by_rule_name(const char *name);
407
409#define action_id_get_actor_kind(act_id) \
410 action_get_actor_kind(action_by_number(act_id))
412 const struct action *paction);
413#define action_id_get_target_kind(act_id) \
414 action_get_target_kind(action_by_number(act_id))
416 const struct action *paction);
417#define action_id_get_sub_target_kind(act_id) \
418 action_get_sub_target_kind(action_by_number(act_id))
419
420int action_number(const struct action *action);
421
422#define action_id(_act_) (_act_->id)
423
424#define action_has_result_safe(paction, result) \
425 (paction && action_has_result(paction, result))
426#define action_id_has_result_safe(act_id, result) \
427 (action_by_number(act_id) \
428 && action_has_result(action_by_number(act_id), result))
429
430bool action_has_complex_target(const struct action *paction);
431#define action_id_has_complex_target(act_id) \
432 action_has_complex_target(action_by_number(act_id))
433bool action_requires_details(const struct action *paction);
434#define action_id_requires_details(act_id) \
435 action_requires_details(action_by_number(act_id))
436
437#define action_id_get_act_time(act_id, actor_unit, tgt_tile, tgt_extra) \
438 actres_get_act_time(action_by_number(act_id)->result, \
439 actor_unit, tgt_tile, tgt_extra)
440
442
443bool action_distance_accepted(const struct action *action,
444 const int distance);
445#define action_id_distance_accepted(act_id, distance) \
446 action_distance_accepted(action_by_number(act_id), distance)
447
448bool action_distance_inside_max(const struct action *action,
449 const int distance);
450#define action_id_distance_inside_max(act_id, distance) \
451 action_distance_inside_max(action_by_number(act_id), distance)
452
453bool action_would_be_blocked_by(const struct action *blocked,
454 const struct action *blocker);
455
456int action_get_role(const struct action *paction);
457#define action_id_get_role(act_id) \
458 action_get_role(action_by_number(act_id))
459
460#define action_get_activity(_pact_) \
461 actres_activity_result(_pact_->result)
462#define action_id_get_activity(act_id) \
463 action_get_activity(action_by_number(act_id))
464
465const char *action_rule_name(const struct action *action);
466const char *action_id_rule_name(action_id act_id);
467
468const char *action_name_translation(const struct action *paction);
469const char *action_id_name_translation(action_id act_id);
470const char *action_get_ui_name_mnemonic(action_id act_id,
471 const char *mnemonic);
472const char *action_prepare_ui_name(action_id act_id, const char *mnemonic,
473 const struct act_prob prob,
474 const char *custom);
475
476const char *action_ui_name_ruleset_var_name(int act);
477const char *action_ui_name_default(int act);
478
479const char *action_min_range_ruleset_var_name(int act);
480const char *action_max_range_ruleset_var_name(int act);
481
482const char *action_target_kind_ruleset_var_name(int act);
483const char *action_target_kind_help(enum action_target_kind kind);
484
486
487const char *action_blocked_by_ruleset_var_name(const struct action *act);
488
489const char *
491
493
494struct action_enabler_list *
496
499struct action_enabler *
500action_enabler_copy(const struct action_enabler *original);
503
504struct req_vec_problem *
506struct req_vec_problem *
508struct req_vec_problem *
510
513 const struct requirement_vector *vec);
514struct requirement_vector *
518
520 const struct unit_type *act_utype);
522
523struct action *action_is_blocked_by(const struct civ_map *nmap,
524 const struct action *act,
525 const struct unit *actor_unit,
526 const struct tile *target_tile,
527 const struct city *target_city,
528 const struct unit *target_unit);
529
532 const struct unit *actor_unit,
533 const struct city *target_city);
534
537 const struct unit *actor_unit,
538 const struct unit *target_unit);
539
542 const struct unit *actor_unit,
543 const struct tile *target_tile);
544
547 const struct unit *actor_unit,
548 const struct tile *target_tile,
549 const struct extra_type *target_extra);
550
553 const struct unit *actor_unit,
554 const struct tile *target,
555 const struct extra_type *tgt_extra);
556
559 const struct unit *actor_unit);
560
561bool is_action_enabled_player(const struct civ_map *nmap,
563 const struct player *actor_plr);
564
566 const struct unit *actor,
567 const action_id act_id,
568 const struct city *victim);
569
571 const struct unit *actor,
572 const action_id act_id,
573 const struct unit *victim);
574
576 const struct unit* actor,
577 const action_id act_id,
578 const struct tile* victims);
579
581 const struct unit *actor,
582 const action_id act_id,
583 const struct tile *victims,
584 const struct extra_type *target_extra);
585
587 const struct unit *actor,
588 const action_id act_id,
589 const struct tile *target,
590 const struct extra_type *tgt_extra);
591
593 const struct unit *actor,
594 const action_id act_id);
595
597 const struct action *paction,
598 const struct unit *act_unit,
599 const struct city *tgt_city,
600 const struct unit *tgt_unit,
601 const struct tile *tgt_tile,
602 const struct extra_type *sub_tgt);
603
604struct act_prob
606 action_id act_id,
607 const struct unit *actor,
608 const struct city *actor_home,
609 const struct tile *actor_tile,
610 bool omniscient_cheat,
611 const struct city* target);
612
613struct act_prob
615 action_id act_id,
616 const struct unit *actor,
617 const struct city *actor_home,
618 const struct tile *actor_tile,
619 bool omniscient_cheat,
620 const struct unit *target);
621
622struct act_prob
624 action_id act_id,
625 const struct unit *actor,
626 const struct city *actor_home,
627 const struct tile *actor_tile,
628 bool omniscient_cheat,
629 const struct tile *target);
630
631struct act_prob
633 action_id act_id,
634 const struct unit *actor,
635 const struct city *actor_home,
636 const struct tile *actor_tile,
637 bool omniscient_cheat,
638 const struct tile *target_tile,
639 const struct extra_type *target_extra);
640
641struct act_prob
643 action_id act_id,
644 const struct unit *actor,
645 const struct city *actor_home,
646 const struct tile *actor_tile,
647 bool omniscient_cheat,
648 const struct tile *target_tile,
649 const struct extra_type *target_extra);
650
651struct act_prob
653 action_id act_id,
654 const struct unit *actor,
655 const struct city *actor_home,
656 const struct tile *actor_tile,
657 bool omniscient_cheat);
658
659bool action_prob_possible(const struct act_prob probability);
660
661bool action_prob_certain(const struct act_prob probability);
662
664 const struct act_prob *ap2);
665
666int action_prob_cmp_pessimist(const struct act_prob ap1,
667 const struct act_prob ap2);
668
669double action_prob_to_0_to_1_pessimist(const struct act_prob ap);
670
672 const struct act_prob *ap2);
673
675 const struct act_prob *ap2);
676
677const char *action_prob_explain(const struct act_prob prob);
678
684
685/* Special action probability values. Documented in fc_types.h's
686 * definition of struct act_prob. */
687#define ACTPROB_IMPOSSIBLE action_prob_new_impossible()
688#define ACTPROB_CERTAIN action_prob_new_certain()
689#define ACTPROB_NA action_prob_new_not_relevant()
690#define ACTPROB_NOT_IMPLEMENTED action_prob_new_not_impl()
691#define ACTPROB_NOT_KNOWN action_prob_new_unknown()
692
693/* ACTION_ODDS_PCT_DICE_ROLL_NA must be above 100%. */
694#define ACTION_ODDS_PCT_DICE_ROLL_NA 110
696int action_dice_roll_odds(const struct player *act_player,
697 const struct unit *act_unit,
698 const struct city *tgt_city,
699 const struct player *tgt_player,
700 const struct action *paction);
701
702bool
703action_actor_utype_hard_reqs_ok(const struct action *result,
704 const struct unit_type *actor_unittype);
705
706/* Reasoning about actions */
707bool action_univs_not_blocking(const struct action *paction,
708 struct universal *actor_uni,
709 struct universal *target_uni);
710#define action_id_univs_not_blocking(act_id, act_uni, tgt_uni) \
711 action_univs_not_blocking(action_by_number(act_id), act_uni, tgt_uni)
712
713bool action_immune_government(struct government *gov, action_id act);
714
716 const struct player *actor_player,
717 const struct city *target_city);
718
721 const struct unit *actor_unit);
722
723bool action_mp_full_makes_legal(const struct unit *actor,
724 const action_id act_id);
725
726bool action_is_in_use(struct action *paction);
727
728bool action_is_internal(struct action *paction);
730
731/* Action lists */
734 int *position,
735 enum action_result result);
736
737/* Action auto performers */
738const struct action_auto_perf *action_auto_perf_by_number(const int num);
740
741#ifdef __cplusplus
742}
743#endif /* __cplusplus */
744
745#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:5491
const char * action_prepare_ui_name(action_id act_id, const char *mnemonic, const struct act_prob prob, const char *custom)
Definition actions.c:1312
bool action_distance_inside_max(const struct action *action, const int distance)
Definition actions.c:1173
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:4979
const char * action_prob_explain(const struct act_prob prob)
Definition actions.c:1423
struct act_prob action_prob_vs_stack(const struct civ_map *nmap, const struct unit *actor, const action_id act_id, const struct tile *victims)
Definition actions.c:4529
bool action_mp_full_makes_legal(const struct unit *actor, const action_id act_id)
Definition actions.c:5569
enum action_actor_kind action_get_actor_kind(const struct action *paction)
Definition actions.c:1098
bool action_prob_certain(const struct act_prob probability)
Definition actions.c:5101
const char * action_id_name_translation(action_id act_id)
Definition actions.c:1250
struct action_auto_perf * action_auto_perf_slot_number(const int num)
Definition actions.c:5722
req_vec_num_in_item action_enabler_vector_number(const void *enabler, const struct requirement_vector *vec)
Definition actions.c:2052
bool action_has_complex_target(const struct action *paction)
Definition actions.c:1132
struct req_vec_problem * action_enabler_suggest_repair(const struct action_enabler *enabler)
Definition actions.c:1922
bool action_prob_possible(const struct act_prob probability)
Definition actions.c:5091
struct act_prob action_prob_new_not_impl(void)
Definition actions.c:5070
struct req_vec_problem * action_enabler_suggest_improvement(const struct action_enabler *enabler)
Definition actions.c:1988
struct act_prob action_speculate_unit_on_stack(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:4912
void actions_rs_pre_san_gen(void)
Definition actions.c:890
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:4787
const char * action_min_range_ruleset_var_name(int act)
Definition actions.c:6469
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:5013
const char * action_blocked_by_ruleset_var_name(const struct action *act)
Definition actions.c:7179
struct req_vec_problem * action_enabler_suggest_repair_oblig(const struct action_enabler *enabler)
Definition actions.c:1683
void action_array_add_all_by_result(action_id *act_array, int *position, enum action_result result)
Definition actions.c:5787
const char * action_name_translation(const struct action *paction)
Definition actions.c:1230
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:5391
void action_array_end(action_id *act_array, int size)
Definition actions.c:5770
static struct action * action_by_number(action_id act_id)
Definition actions.h:396
bool action_maybe_possible_actor_unit(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit)
Definition actions.c:5514
bool action_is_in_use(struct action *paction)
Definition actions.c:5676
bool action_ever_possible(action_id action)
Definition actions.c:7550
const char * action_enabler_vector_by_number_name(req_vec_num_in_item vec)
Definition actions.c:2099
bool are_action_probabilitys_equal(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5142
const char * action_post_success_forced_ruleset_var_name(const struct action *act)
Definition actions.c:7373
struct action * action_by_rule_name(const char *name)
Definition actions.c:1079
const char * action_rule_name(const struct action *action)
Definition actions.c:1216
const char * action_id_rule_name(action_id act_id)
Definition actions.c:1239
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Definition actions.c:1119
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:2286
void actions_free(void)
Definition actions.c:900
void action_enabler_free(struct action_enabler *enabler)
Definition actions.c:1495
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:3256
struct action_list * action_list_by_activity(enum unit_activity activity)
Definition actions.c:7612
int action_number(const struct action *action)
Definition actions.c:1208
struct act_prob action_prob_new_unknown(void)
Definition actions.c:5080
bool action_would_be_blocked_by(const struct action *blocked, const struct action *blocker)
Definition actions.c:1196
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:3332
struct act_prob action_prob_and(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5229
const char * action_actor_consuming_always_ruleset_var_name(action_id act)
Definition actions.c:7006
bool action_immune_government(struct government *gov, action_id act)
Definition actions.c:5447
struct act_prob action_prob_new_certain(void)
Definition actions.c:5050
const char * action_max_range_ruleset_var_name(int act)
Definition actions.c:6647
bool action_is_internal(struct action *paction)
Definition actions.c:5702
int action_dice_roll_initial_odds(const struct action *paction)
Definition actions.c:5367
struct act_prob action_prob_fall_back(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5299
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:3091
struct act_prob action_prob_self(const struct civ_map *nmap, const struct unit *actor, const action_id act_id)
Definition actions.c:4765
struct action_list * action_list_by_result(enum action_result result)
Definition actions.c:7602
#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:5746
bool actions_are_ready(void)
Definition actions.c:942
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:3168
bool action_actor_utype_hard_reqs_ok(const struct action *result, const struct unit_type *actor_unittype)
Definition actions.c:2607
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:4945
const char * action_target_kind_ruleset_var_name(int act)
Definition actions.c:6834
void action_enabler_add(struct action_enabler *enabler)
Definition actions.c:1526
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:4612
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:4337
const char * action_ui_name_default(int act)
Definition actions.c:6105
bool action_enabler_utype_possible_actor(const struct action_enabler *ae, const struct unit_type *act_utype)
Definition actions.c:5592
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:4844
struct action_enabler * action_enabler_new(void)
Definition actions.c:1475
bool action_requires_details(const struct action *paction)
Definition actions.c:1145
struct act_prob action_prob_new_not_relevant(void)
Definition actions.c:5060
const char * action_target_kind_help(enum action_target_kind kind)
Definition actions.c:7592
int action_get_role(const struct action *paction)
Definition actions.c:1463
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:4254
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:4879
const struct action_auto_perf * action_auto_perf_by_number(const int num)
Definition actions.c:5738
struct act_prob action_prob_new_impossible(void)
Definition actions.c:5040
bool action_enabler_possible_actor(const struct action_enabler *ae)
Definition actions.c:5619
struct action ** _actions
Definition actions.c:58
bool action_id_exists(const action_id act_id)
Definition actions.c:1068
bool action_enabler_remove(struct action_enabler *enabler)
Definition actions.c:1543
enum action_target_kind action_get_target_kind(const struct action *paction)
Definition actions.c:1108
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:4695
struct action_enabler * action_enabler_copy(const struct action_enabler *original)
Definition actions.c:1511
int action_prob_cmp_pessimist(const struct act_prob ap1, const struct act_prob ap2)
Definition actions.c:5151
bool action_id_is_internal(action_id act)
Definition actions.c:5714
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:3481
bool action_id_is_rare_pop_up(action_id act_id)
Definition actions.c:1160
void actions_init(void)
Definition actions.c:841
struct requirement_vector * action_enabler_vector_by_number(const void *enabler, req_vec_num_in_item vec)
Definition actions.c:2075
bool is_action_enabled_player(const struct civ_map *nmap, const action_id wanted_action, const struct player *actor_plr)
Definition actions.c:3494
double action_prob_to_0_to_1_pessimist(const struct act_prob ap)
Definition actions.c:5202
const char * gen_action_name_update_cb(const char *old_name)
Definition actions.c:7558
struct action_enabler_list * action_enablers_for_action(action_id action)
Definition actions.c:1559
bool action_distance_accepted(const struct action *action, const int distance)
Definition actions.c:1184
const char * action_ui_name_ruleset_var_name(int act)
Definition actions.c:5807
const char * action_get_ui_name_mnemonic(action_id act_id, const char *mnemonic)
Definition actions.c:1258
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:3409
char * incite_cost
Definition comments.c:76
struct unit struct city struct unit * target_unit
Definition dialogs_g.h:56
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 * actor_unit
Definition dialogs_g.h:55
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:248
#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:327
enum action_auto_perf_cause cause
Definition actions.h:323
action_id alternatives[MAX_NUM_ACTIONS]
Definition actions.h:331
char * comment
Definition actions.h:176
struct action_enabler::@14 rulesave
bool ruledit_disabled
Definition actions.h:174
action_id action
Definition actions.h:167
struct requirement_vector actor_reqs
Definition actions.h:168
struct requirement_vector target_reqs
Definition actions.h:169
bool unitwaittime_controlled
Definition actions.h:156
action_id id
Definition actions.h:107
bool actor_consuming_always
Definition actions.h:140
bool rare_pop_up
Definition actions.h:153
int max_distance
Definition actions.h:123
bool quiet
Definition actions.h:130
enum action_sub_target_kind sub_target_kind
Definition actions.h:115
enum moves_actor_kind moves_actor
Definition actions.h:160
struct action::@12::@13 is_unit
enum action_result result
Definition actions.h:110
char ui_name[MAX_LEN_NAME]
Definition actions.h:126
bv_action_sub_results sub_results
Definition actions.h:111
enum action_actor_kind actor_kind
Definition actions.h:113
enum act_tgt_compl target_complexity
Definition actions.h:118
bv_actions blocked_by
Definition actions.h:134
bool configured
Definition actions.h:108
union action::@12 actor
enum action_target_kind target_kind
Definition actions.h:114
int min_distance
Definition actions.h:123
Definition city.h:317
Definition tile.h:50
Definition unit.h:140