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/* Used in the network protocol. */
41#define SPECENUM_NAME action_actor_kind
42#define SPECENUM_VALUE0 AAK_UNIT
43#define SPECENUM_VALUE0NAME N_("a unit")
44#define SPECENUM_VALUE1 AAK_CITY
45#define SPECENUM_VALUE1NAME N_("a city")
46#define SPECENUM_VALUE2 AAK_PLAYER
47#define SPECENUM_VALUE2NAME N_("a player")
48#define SPECENUM_COUNT AAK_COUNT
49#include "specenum_gen.h"
50
51const char *gen_action_name_update_cb(const char *old_name);
52
53#include "actions_enums_gen.h"
54
55/* Fake action id used in searches to signal "any action at all". */
56#define ACTION_ANY ACTION_COUNT
57
58/* Fake action id used to signal the absence of any actions. */
59#define ACTION_NONE ACTION_COUNT
60
61/* Used in the network protocol. */
62#define MAX_NUM_ACTIONS ACTION_COUNT
63#define NUM_ACTIONS MAX_NUM_ACTIONS
64
65/* Describes how a unit successfully performing an action will move it. */
66#define SPECENUM_NAME moves_actor_kind
67#define SPECENUM_VALUE0 MAK_STAYS
68#define SPECENUM_VALUE0NAME N_("stays")
69#define SPECENUM_VALUE1 MAK_REGULAR
70#define SPECENUM_VALUE1NAME N_("regular")
71#define SPECENUM_VALUE2 MAK_TELEPORT
72#define SPECENUM_VALUE2NAME N_("teleport")
73#define SPECENUM_VALUE3 MAK_ESCAPE
74#define SPECENUM_VALUE3NAME N_("escape")
75#define SPECENUM_VALUE4 MAK_FORCED
76#define SPECENUM_VALUE4NAME N_("forced")
77#define SPECENUM_VALUE5 MAK_UNREPRESENTABLE
78#define SPECENUM_VALUE5NAME N_("unrepresentable")
79#include "specenum_gen.h"
80
81/* Who ordered the action to be performed? */
82#define SPECENUM_NAME action_requester
83/* The player ordered it directly. */
84#define SPECENUM_VALUE0 ACT_REQ_PLAYER
85#define SPECENUM_VALUE0NAME N_("the player")
86/* The game it self because the rules requires it. */
87#define SPECENUM_VALUE1 ACT_REQ_RULES
88#define SPECENUM_VALUE1NAME N_("the game rules")
89/* A server side autonomous agent working for the player. */
90#define SPECENUM_VALUE2 ACT_REQ_SS_AGENT
91#define SPECENUM_VALUE2NAME N_("a server agent")
92/* Number of action requesters. */
93#define SPECENUM_COUNT ACT_REQ_COUNT
94#include "specenum_gen.h"
95
96/* The last action distance value that is interpreted as an actual
97 * distance rather than as a signal value.
98 *
99 * It is specified literally rather than referring to MAP_DISTANCE_MAX
100 * because Freeciv-web's MAP_DISTANCE_MAX differs from the regular Freeciv
101 * server's MAP_DISTANCE_MAX. A static assertion in actions.c makes sure
102 * that it can cover the whole map. */
103#define ACTION_DISTANCE_LAST_NON_SIGNAL 128016
104/* No action max distance to target limit. */
105#define ACTION_DISTANCE_UNLIMITED (ACTION_DISTANCE_LAST_NON_SIGNAL + 1)
106/* No action max distance can be bigger than this. */
107#define ACTION_DISTANCE_MAX ACTION_DISTANCE_UNLIMITED
108
109struct action
110{
113
116
120
121 /* Sub target policy. */
123
124 /* Limits on the distance on the map between the actor and the target.
125 * The action is legal iff the distance is min_distance, max_distance or
126 * a value in between. */
128
129 /* The name of the action shown in the UI */
131
132 /* Suppress automatic help text generation about what enables and/or
133 * disables this action. */
134 bool quiet;
135
136 /* Actions that blocks this action. The action will be illegal if any
137 * bloking action is legal. */
139
140 /* Successfully performing this action will always consume the actor.
141 * Don't set this for actions that consumes the unit in some cases
142 * (depending on luck, the presence of a flag, etc) but not in other
143 * cases. */
145
146 union {
147 struct {
148 /* A unit's ability to perform this action will pop up the action
149 * selection dialog before the player asks for it only in exceptional
150 * cases.
151 *
152 * The motivation for setting rare_pop_up is to minimize player
153 * annoyance and mistakes. Getting a pop up every time a unit moves is
154 * annoying. An unexpected offer to do something that in many cases is
155 * destructive can lead the player's muscle memory to perform the
156 * wrong action. */
158
159 /* The unitwaittime setting blocks this action when done too soon. */
161
162 /* How successfully performing the specified action always will move
163 * the actor unit of the specified type. */
167};
168
170{
174
175 struct {
176 /* Only relevant for ruledit and other rulesave users. Indicates that
177 * this action enabler is deleted and shouldn't be saved. */
179
180 char *comment;
182};
183
184#define action_has_result(_act_, _res_) ((_act_)->result == (_res_))
185
186#define enabler_get_action(_enabler_) action_by_number(_enabler_->action)
187#define enabler_get_action_id(_enabler_) (_enabler_->action)
188
189#define SPECLIST_TAG action_enabler
190#define SPECLIST_TYPE struct action_enabler
191#include "speclist.h"
192#define action_enabler_list_iterate(action_enabler_list, aenabler) \
193 TYPED_LIST_ITERATE(struct action_enabler, action_enabler_list, aenabler)
194#define action_enabler_list_iterate_end LIST_ITERATE_END
195
196#define action_enabler_list_re_iterate(action_enabler_list, aenabler) \
197 action_enabler_list_iterate(action_enabler_list, aenabler) { \
198 if (!aenabler->rulesave.ruledit_disabled) {
199
200#define action_enabler_list_re_iterate_end \
201 } \
202 } action_enabler_list_iterate_end
203
204#define action_iterate_all(_act_) \
205{ \
206 action_id _act_; \
207 for (_act_ = 0; _act_ < NUM_ACTIONS; _act_++) {
208
209#define action_iterate_all_end \
210 } \
211}
212
213/* Filter out unused action slots, in versions where those exist */
214#define action_iterate(_act_) \
215{ \
216 action_iterate_all(_act_) {
217
218#define action_iterate_end \
219 } action_iterate_all_end; \
220}
221
222/* Get 'struct action_id_list' and related functions: */
223#define SPECLIST_TAG action
224#define SPECLIST_TYPE struct action
225#include "speclist.h"
226
227#define action_list_iterate(_list_, _act_) \
228 TYPED_LIST_ITERATE(struct action, _list_, _act_)
229#define action_list_iterate_end LIST_ITERATE_END
230
233
234/* TODO: Turn this to an iteration over precalculated list */
235#define action_noninternal_iterate(_act_) \
236{ \
237 action_iterate(_act_) { \
238 if (!action_id_is_internal(_act_)) {
239
240#define action_noninternal_iterate_end \
241 } \
242 } action_iterate_end; \
243}
244
245#define action_by_result_iterate(_paction_, _result_) \
246{ \
247 action_list_iterate(action_list_by_result(_result_), _paction_) { \
248
249#define action_by_result_iterate_end \
250 } action_list_iterate_end; \
251}
252
253#define action_by_activity_iterate(_paction_, _activity_) \
254{ \
255 action_list_iterate(action_list_by_activity(_activity_), _paction_) {
256
257#define action_by_activity_iterate_end \
258 } action_list_iterate_end; \
259}
260
261#define action_array_iterate(_act_array_, _act_id_) \
262{ \
263 int _pos_; \
264 \
265 for (_pos_ = 0; _pos_ < NUM_ACTIONS; _pos_++) { \
266 const action_id _act_id_ = _act_array_[_pos_]; \
267 \
268 if (_act_id_ == ACTION_NONE) { \
269 /* No more actions in this list. */ \
270 break; \
271 }
272
273#define action_array_iterate_end \
274 } \
275}
276
277#define action_enablers_iterate(_enabler_) \
278{ \
279 action_iterate(_act_) { \
280 action_enabler_list_iterate( \
281 action_enablers_for_action(_act_), _enabler_) {
282
283#define action_enablers_iterate_end \
284 } action_enabler_list_iterate_end; \
285 } action_iterate_end; \
286}
287
288/* The reason why an action should be auto performed. */
289#define SPECENUM_NAME action_auto_perf_cause
290/* Can't pay the unit's upkeep. */
291/* (Can be triggered by food, shield or gold upkeep) */
292#define SPECENUM_VALUE0 AAPC_UNIT_UPKEEP
293#define SPECENUM_VALUE0NAME "Unit Upkeep"
294/* A unit moved to an adjacent tile (auto attack). */
295#define SPECENUM_VALUE1 AAPC_UNIT_MOVED_ADJ
296#define SPECENUM_VALUE1NAME "Moved Adjacent"
297/* An action was successfully performed and the (action specific) conditions
298 * for forcing a post action move are fulfilled. */
299#define SPECENUM_VALUE2 AAPC_POST_ACTION
300#define SPECENUM_VALUE2NAME "After Successful Action"
301/* The city that made the unit's current tile native is gone. Evaluated
302 * against an adjacent tile. */
303#define SPECENUM_VALUE3 AAPC_CITY_GONE
304#define SPECENUM_VALUE3NAME "City Gone"
305/* The unit's stack has been defeated and is scheduled for execution but the
306 * unit has the CanEscape unit type flag.
307 * Evaluated against an adjacent tile. */
308#define SPECENUM_VALUE4 AAPC_UNIT_STACK_DEATH
309#define SPECENUM_VALUE4NAME "Unit Stack Dead"
310/* Number of forced action auto performer causes. */
311#define SPECENUM_COUNT AAPC_COUNT
312#include "specenum_gen.h"
313
314/* An Action Auto Performer rule makes an actor try to perform an action
315 * without being ordered to do so by the player controlling it.
316 * - the first auto performer that matches the cause and fulfills the reqs
317 * is selected.
318 * - the actions listed by the selected auto performer is tried in order
319 * until an action is successful, all actions have been tried or the
320 * actor disappears.
321 * - if no action inside the selected auto performer is legal no action is
322 * performed. The system won't try to select another auto performer.
323 */
325{
326 /* The reason for trying to auto perform an action. */
328
329 /* Must be fulfilled if the game should try to force an action from this
330 * action auto performer. */
332
333 /* Auto perform the first legal action in this list.
334 * The list is terminated by ACTION_NONE. */
336};
337
338#define action_auto_perf_iterate(_act_perf_) \
339{ \
340 int _ap_num_; \
341 \
342 for (_ap_num_ = 0; \
343 _ap_num_ < MAX_NUM_ACTION_AUTO_PERFORMERS \
344 && (action_auto_perf_by_number(_ap_num_)->cause \
345 != AAPC_COUNT); \
346 _ap_num_++) { \
347 const struct action_auto_perf *_act_perf_ \
348 = action_auto_perf_by_number(_ap_num_);
349
350#define action_auto_perf_iterate_end \
351 } \
352}
353
354#define action_auto_perf_by_cause_iterate(_cause_, _act_perf_) \
355action_auto_perf_iterate(_act_perf_) { \
356 if (_act_perf_->cause != _cause_) { \
357 continue; \
358 }
359
360#define action_auto_perf_by_cause_iterate_end \
361} action_auto_perf_iterate_end
362
363#define action_auto_perf_actions_iterate(_autoperf_, _act_id_) \
364 action_array_iterate(_autoperf_->alternatives, _act_id_)
365
366#define action_auto_perf_actions_iterate_end \
367 action_array_iterate_end
368
369/* Hard coded location of action auto performers. Used for conversion while
370 * action auto performers aren't directly exposed to the ruleset.
371 * Remember to update also MAX_NUM_ACTION_AUTO_PERFORMERS when changing these. */
372#define ACTION_AUTO_UPKEEP_FOOD 0
373#define ACTION_AUTO_UPKEEP_GOLD 1
374#define ACTION_AUTO_UPKEEP_SHIELD 2
375#define ACTION_AUTO_MOVED_ADJ 3
376#define ACTION_AUTO_POST_BRIBE_UNIT 4
377#define ACTION_AUTO_POST_BRIBE_STACK 5
378#define ACTION_AUTO_POST_ATTACK 6
379#define ACTION_AUTO_POST_ATTACK2 7
380#define ACTION_AUTO_POST_COLLECT_RANSOM 8
381#define ACTION_AUTO_ESCAPE_CITY 9
382#define ACTION_AUTO_ESCAPE_STACK 10
383#define ACTION_AUTO_POST_WIPE_UNITS 11
384
385/* Initialization */
386void actions_init(void);
387void actions_rs_pre_san_gen(void);
388void actions_free(void);
389
390bool actions_are_ready(void);
391
392bool action_id_exists(const action_id act_id);
393
394extern struct action **_actions;
395/**********************************************************************/
400static inline struct action *action_by_number(action_id act_id)
401{
402 if (!gen_action_is_valid((enum gen_action)act_id)) {
403 return NULL;
404 }
405
406 /* We return NULL if there's NULL there, no need to special case it */
407 return _actions[act_id];
408}
409
410struct action *action_by_rule_name(const char *name);
411
413#define action_id_get_actor_kind(act_id) \
414 action_get_actor_kind(action_by_number(act_id))
416 const struct action *paction);
417#define action_id_get_target_kind(act_id) \
418 action_get_target_kind(action_by_number(act_id))
420 const struct action *paction);
421#define action_id_get_sub_target_kind(act_id) \
422 action_get_sub_target_kind(action_by_number(act_id))
423
424int action_number(const struct action *action);
425
426#define action_id(_act_) (_act_->id)
427
428#define action_has_result_safe(paction, result) \
429 (paction && action_has_result(paction, result))
430#define action_id_has_result_safe(act_id, result) \
431 (action_by_number(act_id) \
432 && action_has_result(action_by_number(act_id), result))
433
434bool action_has_complex_target(const struct action *paction);
435#define action_id_has_complex_target(act_id) \
436 action_has_complex_target(action_by_number(act_id))
437bool action_requires_details(const struct action *paction);
438#define action_id_requires_details(act_id) \
439 action_requires_details(action_by_number(act_id))
440
441#define action_id_get_act_time(act_id, actor_unit, tgt_tile, tgt_extra) \
442 actres_get_act_time(action_by_number(act_id)->result, \
443 actor_unit, tgt_tile, tgt_extra)
444
446
447bool action_distance_accepted(const struct action *action,
448 const int distance);
449#define action_id_distance_accepted(act_id, distance) \
450 action_distance_accepted(action_by_number(act_id), distance)
451
452bool action_distance_inside_max(const struct action *action,
453 const int distance);
454#define action_id_distance_inside_max(act_id, distance) \
455 action_distance_inside_max(action_by_number(act_id), distance)
456
457bool action_would_be_blocked_by(const struct action *blocked,
458 const struct action *blocker);
459
460int action_get_role(const struct action *paction);
461#define action_id_get_role(act_id) \
462 action_get_role(action_by_number(act_id))
463
464#define action_get_activity(_pact_) \
465 actres_activity_result(_pact_->result)
466#define action_id_get_activity(act_id) \
467 action_get_activity(action_by_number(act_id))
468
469const char *action_rule_name(const struct action *action);
470const char *action_id_rule_name(action_id act_id);
471
472const char *action_name_translation(const struct action *paction);
473const char *action_id_name_translation(action_id act_id);
474const char *action_get_ui_name_mnemonic(action_id act_id,
475 const char *mnemonic);
476const char *action_prepare_ui_name(action_id act_id, const char *mnemonic,
477 const struct act_prob prob,
478 const char *custom);
479
480const char *action_ui_name_ruleset_var_name(int act);
481const char *action_ui_name_default(int act);
482
483const char *action_min_range_ruleset_var_name(int act);
484const char *action_max_range_ruleset_var_name(int act);
485
486const char *action_target_kind_ruleset_var_name(int act);
487const char *action_target_kind_help(enum action_target_kind kind);
488
490
491const char *action_blocked_by_ruleset_var_name(const struct action *act);
492
493const char *
495
497
498struct action_enabler_list *
500
503struct action_enabler *
504action_enabler_copy(const struct action_enabler *original);
507
508struct req_vec_problem *
510struct req_vec_problem *
512struct req_vec_problem *
514
517 const struct requirement_vector *vec);
518struct requirement_vector *
522
524 const struct unit_type *act_utype);
526
527struct action *action_is_blocked_by(const struct civ_map *nmap,
528 const struct action *act,
529 const struct unit *actor_unit,
530 const struct tile *target_tile,
531 const struct city *target_city,
532 const struct unit *target_unit);
533
536 const struct unit *actor_unit,
537 const struct city *target_city);
538
541 const struct unit *actor_unit,
542 const struct unit *target_unit);
543
546 const struct unit *actor_unit,
547 const struct tile *target_tile);
548
551 const struct unit *actor_unit,
552 const struct tile *target_tile,
553 const struct extra_type *target_extra);
554
557 const struct unit *actor_unit,
558 const struct tile *target,
559 const struct extra_type *tgt_extra);
560
563 const struct unit *actor_unit);
564
565bool is_action_enabled_player(const struct civ_map *nmap,
567 const struct player *actor_plr);
568
570 const struct unit *actor,
571 const action_id act_id,
572 const struct city *victim);
573
575 const struct unit *actor,
576 const action_id act_id,
577 const struct unit *victim);
578
580 const struct unit* actor,
581 const action_id act_id,
582 const struct tile* victims);
583
585 const struct unit *actor,
586 const action_id act_id,
587 const struct tile *victims,
588 const struct extra_type *target_extra);
589
591 const struct unit *actor,
592 const action_id act_id,
593 const struct tile *target,
594 const struct extra_type *tgt_extra);
595
597 const struct unit *actor,
598 const action_id act_id);
599
601 const struct action *paction,
602 const struct unit *act_unit,
603 const struct city *tgt_city,
604 const struct unit *tgt_unit,
605 const struct tile *tgt_tile,
606 const struct extra_type *sub_tgt);
607
608struct act_prob
610 action_id act_id,
611 const struct unit *actor,
612 const struct city *actor_home,
613 const struct tile *actor_tile,
614 bool omniscient_cheat,
615 const struct city* target);
616
617struct act_prob
619 action_id act_id,
620 const struct unit *actor,
621 const struct city *actor_home,
622 const struct tile *actor_tile,
623 bool omniscient_cheat,
624 const struct unit *target);
625
626struct act_prob
628 action_id act_id,
629 const struct unit *actor,
630 const struct city *actor_home,
631 const struct tile *actor_tile,
632 bool omniscient_cheat,
633 const struct tile *target);
634
635struct act_prob
637 action_id act_id,
638 const struct unit *actor,
639 const struct city *actor_home,
640 const struct tile *actor_tile,
641 bool omniscient_cheat,
642 const struct tile *target_tile,
643 const struct extra_type *target_extra);
644
645struct act_prob
647 action_id act_id,
648 const struct unit *actor,
649 const struct city *actor_home,
650 const struct tile *actor_tile,
651 bool omniscient_cheat,
652 const struct tile *target_tile,
653 const struct extra_type *target_extra);
654
655struct act_prob
657 action_id act_id,
658 const struct unit *actor,
659 const struct city *actor_home,
660 const struct tile *actor_tile,
661 bool omniscient_cheat);
662
663bool action_prob_possible(const struct act_prob probability);
664
665bool action_prob_certain(const struct act_prob probability);
666
668 const struct act_prob *ap2);
669
670int action_prob_cmp_pessimist(const struct act_prob ap1,
671 const struct act_prob ap2);
672
673double action_prob_to_0_to_1_pessimist(const struct act_prob ap);
674
676 const struct act_prob *ap2);
677
679 const struct act_prob *ap2);
680
681const char *action_prob_explain(const struct act_prob prob);
682
688
689/* Special action probability values. Documented in fc_types.h's
690 * definition of struct act_prob. */
691#define ACTPROB_IMPOSSIBLE action_prob_new_impossible()
692#define ACTPROB_CERTAIN action_prob_new_certain()
693#define ACTPROB_NA action_prob_new_not_relevant()
694#define ACTPROB_NOT_IMPLEMENTED action_prob_new_not_impl()
695#define ACTPROB_NOT_KNOWN action_prob_new_unknown()
696
697/* ACTION_ODDS_PCT_DICE_ROLL_NA must be above 100%. */
698#define ACTION_ODDS_PCT_DICE_ROLL_NA 110
700int action_dice_roll_odds(const struct player *act_player,
701 const struct unit *act_unit,
702 const struct city *tgt_city,
703 const struct player *tgt_player,
704 const struct action *paction);
705
706bool
707action_actor_utype_hard_reqs_ok(const struct action *result,
708 const struct unit_type *actor_unittype);
709
710/* Reasoning about actions */
711bool action_univs_not_blocking(const struct action *paction,
712 struct universal *actor_uni,
713 struct universal *target_uni);
714#define action_id_univs_not_blocking(act_id, act_uni, tgt_uni) \
715 action_univs_not_blocking(action_by_number(act_id), act_uni, tgt_uni)
716
717bool action_immune_government(struct government *gov, action_id act);
718
720 const struct player *actor_player,
721 const struct city *target_city);
722
725 const struct unit *actor_unit);
726
727bool action_mp_full_makes_legal(const struct unit *actor,
728 const action_id act_id);
729
730bool action_is_in_use(struct action *paction);
731
732bool action_is_internal(struct action *paction);
734
735/* Action lists */
738 int *position,
739 enum action_result result);
740
741/* Action auto performers */
742const struct action_auto_perf *action_auto_perf_by_number(const int num);
744
745#ifdef __cplusplus
746}
747#endif /* __cplusplus */
748
749#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:5468
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:4956
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:4506
bool action_mp_full_makes_legal(const struct unit *actor, const action_id act_id)
Definition actions.c:5546
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:5078
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:5707
req_vec_num_in_item action_enabler_vector_number(const void *enabler, const struct requirement_vector *vec)
Definition actions.c:2027
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:1897
bool action_prob_possible(const struct act_prob probability)
Definition actions.c:5068
struct act_prob action_prob_new_not_impl(void)
Definition actions.c:5047
struct req_vec_problem * action_enabler_suggest_improvement(const struct action_enabler *enabler)
Definition actions.c:1963
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:4889
void actions_rs_pre_san_gen(void)
Definition actions.c:889
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:4764
const char * action_min_range_ruleset_var_name(int act)
Definition actions.c:6454
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:4990
const char * action_blocked_by_ruleset_var_name(const struct action *act)
Definition actions.c:7164
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:5772
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:5368
void action_array_end(action_id *act_array, int size)
Definition actions.c:5755
static struct action * action_by_number(action_id act_id)
Definition actions.h:400
bool action_maybe_possible_actor_unit(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit)
Definition actions.c:5491
bool action_is_in_use(struct action *paction)
Definition actions.c:5661
bool action_ever_possible(action_id action)
Definition actions.c:7535
const char * action_enabler_vector_by_number_name(req_vec_num_in_item vec)
Definition actions.c:2074
bool are_action_probabilitys_equal(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5119
const char * action_post_success_forced_ruleset_var_name(const struct action *act)
Definition actions.c:7358
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:2261
void actions_free(void)
Definition actions.c:899
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:3233
struct action_list * action_list_by_activity(enum unit_activity activity)
Definition actions.c:7597
int action_number(const struct action *action)
Definition actions.c:1208
struct act_prob action_prob_new_unknown(void)
Definition actions.c:5057
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:3309
struct act_prob action_prob_and(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5206
const char * action_actor_consuming_always_ruleset_var_name(action_id act)
Definition actions.c:6991
bool action_immune_government(struct government *gov, action_id act)
Definition actions.c:5424
struct act_prob action_prob_new_certain(void)
Definition actions.c:5027
const char * action_max_range_ruleset_var_name(int act)
Definition actions.c:6632
bool action_is_internal(struct action *paction)
Definition actions.c:5687
int action_dice_roll_initial_odds(const struct action *paction)
Definition actions.c:5344
struct act_prob action_prob_fall_back(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5276
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:3068
struct act_prob action_prob_self(const struct civ_map *nmap, const struct unit *actor, const action_id act_id)
Definition actions.c:4742
struct action_list * action_list_by_result(enum action_result result)
Definition actions.c:7587
#define MAX_NUM_ACTIONS
Definition actions.h:62
bool action_univs_not_blocking(const struct action *paction, struct universal *actor_uni, struct universal *target_uni)
Definition actions.c:5731
bool actions_are_ready(void)
Definition actions.c:941
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:3145
bool action_actor_utype_hard_reqs_ok(const struct action *result, const struct unit_type *actor_unittype)
Definition actions.c:2584
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:4922
const char * action_target_kind_ruleset_var_name(int act)
Definition actions.c:6819
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:4589
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:4314
const char * action_ui_name_default(int act)
Definition actions.c:6090
bool action_enabler_utype_possible_actor(const struct action_enabler *ae, const struct unit_type *act_utype)
Definition actions.c:5569
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:4821
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:5037
const char * action_target_kind_help(enum action_target_kind kind)
Definition actions.c:7577
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:4231
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:4856
const struct action_auto_perf * action_auto_perf_by_number(const int num)
Definition actions.c:5723
struct act_prob action_prob_new_impossible(void)
Definition actions.c:5017
bool action_enabler_possible_actor(const struct action_enabler *ae)
Definition actions.c:5596
struct action ** _actions
Definition actions.c:57
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:4672
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:5128
bool action_id_is_internal(action_id act)
Definition actions.c:5699
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:3458
bool action_id_is_rare_pop_up(action_id act_id)
Definition actions.c:1160
void actions_init(void)
Definition actions.c:840
struct requirement_vector * action_enabler_vector_by_number(const void *enabler, req_vec_num_in_item vec)
Definition actions.c:2050
bool is_action_enabled_player(const struct civ_map *nmap, const action_id wanted_action, const struct player *actor_plr)
Definition actions.c:3471
double action_prob_to_0_to_1_pessimist(const struct act_prob ap)
Definition actions.c:5179
const char * gen_action_name_update_cb(const char *old_name)
Definition actions.c:7543
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:5792
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:3386
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:331
enum action_auto_perf_cause cause
Definition actions.h:327
action_id alternatives[MAX_NUM_ACTIONS]
Definition actions.h:335
char * comment
Definition actions.h:180
struct action_enabler::@14 rulesave
bool ruledit_disabled
Definition actions.h:178
action_id action
Definition actions.h:171
struct requirement_vector actor_reqs
Definition actions.h:172
struct requirement_vector target_reqs
Definition actions.h:173
bool unitwaittime_controlled
Definition actions.h:160
action_id id
Definition actions.h:111
bool actor_consuming_always
Definition actions.h:144
bool rare_pop_up
Definition actions.h:157
int max_distance
Definition actions.h:127
bool quiet
Definition actions.h:134
enum action_sub_target_kind sub_target_kind
Definition actions.h:119
enum moves_actor_kind moves_actor
Definition actions.h:164
struct action::@12::@13 is_unit
enum action_result result
Definition actions.h:114
char ui_name[MAX_LEN_NAME]
Definition actions.h:130
bv_action_sub_results sub_results
Definition actions.h:115
enum action_actor_kind actor_kind
Definition actions.h:117
enum act_tgt_compl target_complexity
Definition actions.h:122
bv_actions blocked_by
Definition actions.h:138
bool configured
Definition actions.h:112
union action::@12 actor
enum action_target_kind target_kind
Definition actions.h:118
int min_distance
Definition actions.h:127
Definition city.h:317
Definition tile.h:50
Definition unit.h:140