Freeciv-3.4
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);
479const char *action_ui_name_default(int act);
480
481const char *action_min_range_ruleset_var_name(int act);
482const char *action_max_range_ruleset_var_name(int act);
483
484const char *action_target_kind_ruleset_var_name(int act);
485const char *action_target_kind_help(enum action_target_kind kind);
486
488
489const char *action_blocked_by_ruleset_var_name(const struct action *act);
490
491const char *
493
495
496struct action_enabler_list *
498
501struct action_enabler *
502action_enabler_copy(const struct action_enabler *original);
505
506struct req_vec_problem *
508struct req_vec_problem *
510struct req_vec_problem *
512
515 const struct requirement_vector *vec);
516struct requirement_vector *
520
522 const struct unit_type *act_utype);
524
525struct action *action_is_blocked_by(const struct civ_map *nmap,
526 const struct action *act,
527 const struct unit *actor_unit,
528 const struct tile *target_tile,
529 const struct city *target_city,
530 const struct unit *target_unit);
531
534 const struct unit *actor_unit,
535 const struct city *target_city);
536
539 const struct unit *actor_unit,
540 const struct unit *target_unit);
541
544 const struct unit *actor_unit,
545 const struct tile *target_tile);
546
549 const struct unit *actor_unit,
550 const struct tile *target_tile,
551 const struct extra_type *target_extra);
552
555 const struct unit *actor_unit,
556 const struct tile *target,
557 const struct extra_type *tgt_extra);
558
561 const struct unit *actor_unit);
562
565 const struct player *actor_plr);
568 const struct player *actor_plr,
569 const struct city *target_city);
570bool
573 const struct player *actor_plr,
574 const struct tile *target_tile,
575 const struct extra_type *target_extra);
578 const struct player *actor_plr,
579 const struct tile *target_tile,
580 const struct extra_type *target_extra);
583 const struct player *actor_plr,
584 const struct tile *target_tile,
585 const struct extra_type *target_extra);
588 const struct player *actor_plr,
589 const struct unit *target_unit);
590
591bool is_action_enabled_city(const struct civ_map *nmap,
593 const struct city *actor_city);
594
596 const struct unit *actor,
597 const action_id act_id,
598 const struct city *victim);
599
601 const struct unit *actor,
602 const action_id act_id,
603 const struct unit *victim);
604
606 const struct unit* actor,
607 const action_id act_id,
608 const struct tile* victims);
609
611 const struct unit *actor,
612 const action_id act_id,
613 const struct tile *victims,
614 const struct extra_type *target_extra);
615
617 const struct unit *actor,
618 const action_id act_id,
619 const struct tile *target,
620 const struct extra_type *tgt_extra);
621
623 const struct unit *actor,
624 const action_id act_id);
625
627 const struct action *paction,
628 const struct unit *act_unit,
629 const struct city *tgt_city,
630 const struct unit *tgt_unit,
631 const struct tile *tgt_tile,
632 const struct extra_type *sub_tgt);
633
634struct act_prob
636 action_id act_id,
637 const struct unit *actor,
638 const struct city *actor_home,
639 const struct tile *actor_tile,
640 bool omniscient_cheat,
641 const struct city* target);
642
643struct act_prob
645 action_id act_id,
646 const struct unit *actor,
647 const struct city *actor_home,
648 const struct tile *actor_tile,
649 bool omniscient_cheat,
650 const struct unit *target);
651
652struct act_prob
654 action_id act_id,
655 const struct unit *actor,
656 const struct city *actor_home,
657 const struct tile *actor_tile,
658 bool omniscient_cheat,
659 const struct tile *target);
660
661struct act_prob
663 action_id act_id,
664 const struct unit *actor,
665 const struct city *actor_home,
666 const struct tile *actor_tile,
667 bool omniscient_cheat,
668 const struct tile *target_tile,
669 const struct extra_type *target_extra);
670
671struct act_prob
673 action_id act_id,
674 const struct unit *actor,
675 const struct city *actor_home,
676 const struct tile *actor_tile,
677 bool omniscient_cheat,
678 const struct tile *target_tile,
679 const struct extra_type *target_extra);
680
681struct act_prob
683 action_id act_id,
684 const struct unit *actor,
685 const struct city *actor_home,
686 const struct tile *actor_tile,
687 bool omniscient_cheat);
688
689bool action_prob_possible(const struct act_prob probability);
690
691bool action_prob_certain(const struct act_prob probability);
692
694 const struct act_prob *ap2);
695
696int action_prob_cmp_pessimist(const struct act_prob ap1,
697 const struct act_prob ap2);
698
699double action_prob_to_0_to_1_pessimist(const struct act_prob ap);
700
702 const struct act_prob *ap2);
703
705 const struct act_prob *ap2);
706
707const char *action_prob_explain(const struct act_prob prob);
708
714
715/* Special action probability values. Documented in fc_types.h's
716 * definition of struct act_prob. */
717#define ACTPROB_IMPOSSIBLE action_prob_new_impossible()
718#define ACTPROB_CERTAIN action_prob_new_certain()
719#define ACTPROB_NA action_prob_new_not_relevant()
720#define ACTPROB_NOT_IMPLEMENTED action_prob_new_not_impl()
721#define ACTPROB_NOT_KNOWN action_prob_new_unknown()
722
723/* ACTION_ODDS_PCT_DICE_ROLL_NA must be above 100%. */
724#define ACTION_ODDS_PCT_DICE_ROLL_NA 110
726int action_dice_roll_odds(const struct player *act_player,
727 const struct unit *act_unit,
728 const struct city *tgt_city,
729 const struct player *tgt_player,
730 const struct action *paction);
731
732bool
733action_actor_utype_hard_reqs_ok(const struct action *result,
734 const struct unit_type *actor_unittype);
735
736/* Reasoning about actions */
737bool action_univs_not_blocking(const struct action *paction,
738 struct universal *actor_uni,
739 struct universal *target_uni);
740#define action_id_univs_not_blocking(act_id, act_uni, tgt_uni) \
741 action_univs_not_blocking(action_by_number(act_id), act_uni, tgt_uni)
742
743bool action_immune_government(struct government *gov, action_id act);
744
746 const struct player *actor_player,
747 const struct city *target_city);
748
751 const struct unit *actor_unit);
752
753bool action_mp_full_makes_legal(const struct unit *actor,
754 const action_id act_id);
755
756bool action_is_in_use(struct action *paction);
757
758bool action_is_internal(struct action *paction);
760
761/* Action lists */
764 int *position,
765 enum action_result result);
766
767/* Action auto performers */
768const struct action_auto_perf *action_auto_perf_by_number(const int num);
770
771#ifdef __cplusplus
772}
773#endif /* __cplusplus */
774
775#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:5706
const char * action_prepare_ui_name(action_id act_id, const char *mnemonic, const struct act_prob prob, const char *custom)
Definition actions.c:1333
bool action_distance_inside_max(const struct action *action, const int distance)
Definition actions.c:1194
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:5194
const char * action_prob_explain(const struct act_prob prob)
Definition actions.c:1444
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:4744
bool action_mp_full_makes_legal(const struct unit *actor, const action_id act_id)
Definition actions.c:5784
enum action_actor_kind action_get_actor_kind(const struct action *paction)
Definition actions.c:1119
bool action_prob_certain(const struct act_prob probability)
Definition actions.c:5316
const char * action_id_name_translation(action_id act_id)
Definition actions.c:1271
struct action_auto_perf * action_auto_perf_slot_number(const int num)
Definition actions.c:5945
req_vec_num_in_item action_enabler_vector_number(const void *enabler, const struct requirement_vector *vec)
Definition actions.c:2048
bool action_has_complex_target(const struct action *paction)
Definition actions.c:1153
struct req_vec_problem * action_enabler_suggest_repair(const struct action_enabler *enabler)
Definition actions.c:1918
bool action_prob_possible(const struct act_prob probability)
Definition actions.c:5306
struct act_prob action_prob_new_not_impl(void)
Definition actions.c:5285
struct req_vec_problem * action_enabler_suggest_improvement(const struct action_enabler *enabler)
Definition actions.c:1984
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:5127
void actions_rs_pre_san_gen(void)
Definition actions.c:899
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:5002
const char * action_min_range_ruleset_var_name(int act)
Definition actions.c:6396
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:5228
const char * action_blocked_by_ruleset_var_name(const struct action *act)
Definition actions.c:7114
struct req_vec_problem * action_enabler_suggest_repair_oblig(const struct action_enabler *enabler)
Definition actions.c:1704
void action_array_add_all_by_result(action_id *act_array, int *position, enum action_result result)
Definition actions.c:6010
const char * action_name_translation(const struct action *paction)
Definition actions.c:1251
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:5606
void action_array_end(action_id *act_array, int size)
Definition actions.c:5993
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:5729
bool action_is_in_use(struct action *paction)
Definition actions.c:5899
bool action_ever_possible(action_id action)
Definition actions.c:7489
const char * action_enabler_vector_by_number_name(req_vec_num_in_item vec)
Definition actions.c:2095
bool are_action_probabilitys_equal(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5357
bool is_action_enabled_player_on_tile(const struct civ_map *nmap, const action_id wanted_action, const struct player *actor_plr, const struct tile *target_tile, const struct extra_type *target_extra)
Definition actions.c:3646
const char * action_post_success_forced_ruleset_var_name(const struct action *act)
Definition actions.c:7310
struct action * action_by_rule_name(const char *name)
Definition actions.c:1100
const char * action_rule_name(const struct action *action)
Definition actions.c:1237
const char * action_id_rule_name(action_id act_id)
Definition actions.c:1260
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Definition actions.c:1140
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:2282
void actions_free(void)
Definition actions.c:909
void action_enabler_free(struct action_enabler *enabler)
Definition actions.c:1516
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:3257
struct action_list * action_list_by_activity(enum unit_activity activity)
Definition actions.c:7539
int action_number(const struct action *action)
Definition actions.c:1229
struct act_prob action_prob_new_unknown(void)
Definition actions.c:5295
bool action_would_be_blocked_by(const struct action *blocked, const struct action *blocker)
Definition actions.c:1217
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:3333
struct act_prob action_prob_and(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5444
const char * action_actor_consuming_always_ruleset_var_name(action_id act)
Definition actions.c:6939
bool action_immune_government(struct government *gov, action_id act)
Definition actions.c:5662
struct act_prob action_prob_new_certain(void)
Definition actions.c:5265
const char * action_max_range_ruleset_var_name(int act)
Definition actions.c:6576
bool action_is_internal(struct action *paction)
Definition actions.c:5925
int action_dice_roll_initial_odds(const struct action *paction)
Definition actions.c:5582
struct act_prob action_prob_fall_back(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5514
bool is_action_enabled_city(const struct civ_map *nmap, const action_id wanted_action, const struct city *actor_city)
Definition actions.c:3707
bool is_action_enabled_player_on_stack(const struct civ_map *nmap, const action_id wanted_action, const struct player *actor_plr, const struct tile *target_tile, const struct extra_type *target_extra)
Definition actions.c:3601
bool is_action_enabled_player_on_city(const struct civ_map *nmap, const action_id wanted_action, const struct player *actor_plr, const struct city *target_city)
Definition actions.c:3532
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:3092
struct act_prob action_prob_self(const struct civ_map *nmap, const struct unit *actor, const action_id act_id)
Definition actions.c:4980
struct action_list * action_list_by_result(enum action_result result)
Definition actions.c:7529
#define MAX_NUM_ACTIONS
Definition actions.h:62
bool is_action_enabled_player_on_self(const struct civ_map *nmap, const action_id wanted_action, const struct player *actor_plr)
Definition actions.c:3510
bool action_univs_not_blocking(const struct action *paction, struct universal *actor_uni, struct universal *target_uni)
Definition actions.c:5969
bool actions_are_ready(void)
Definition actions.c:951
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:3169
bool action_actor_utype_hard_reqs_ok(const struct action *result, const struct unit_type *actor_unittype)
Definition actions.c:2605
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:5160
const char * action_target_kind_ruleset_var_name(int act)
Definition actions.c:6765
void action_enabler_add(struct action_enabler *enabler)
Definition actions.c:1547
bool is_action_enabled_player_on_extras(const struct civ_map *nmap, const action_id wanted_action, const struct player *actor_plr, const struct tile *target_tile, const struct extra_type *target_extra)
Definition actions.c:3570
bool is_action_enabled_player_on_unit(const struct civ_map *nmap, const action_id wanted_action, const struct player *actor_plr, const struct unit *target_unit)
Definition actions.c:3677
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:4827
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:4552
const char * action_ui_name_default(int act)
Definition actions.c:6028
bool action_enabler_utype_possible_actor(const struct action_enabler *ae, const struct unit_type *act_utype)
Definition actions.c:5807
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:5059
struct action_enabler * action_enabler_new(void)
Definition actions.c:1496
bool action_requires_details(const struct action *paction)
Definition actions.c:1166
struct act_prob action_prob_new_not_relevant(void)
Definition actions.c:5275
const char * action_target_kind_help(enum action_target_kind kind)
Definition actions.c:7519
int action_get_role(const struct action *paction)
Definition actions.c:1484
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:4469
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:5094
const struct action_auto_perf * action_auto_perf_by_number(const int num)
Definition actions.c:5961
struct act_prob action_prob_new_impossible(void)
Definition actions.c:5255
bool action_enabler_possible_actor(const struct action_enabler *ae)
Definition actions.c:5834
struct action ** _actions
Definition actions.c:58
bool action_id_exists(const action_id act_id)
Definition actions.c:1089
bool action_enabler_remove(struct action_enabler *enabler)
Definition actions.c:1564
enum action_target_kind action_get_target_kind(const struct action *paction)
Definition actions.c:1129
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:4910
struct action_enabler * action_enabler_copy(const struct action_enabler *original)
Definition actions.c:1532
int action_prob_cmp_pessimist(const struct act_prob ap1, const struct act_prob ap2)
Definition actions.c:5366
bool action_id_is_internal(action_id act)
Definition actions.c:5937
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:3482
bool action_id_is_rare_pop_up(action_id act_id)
Definition actions.c:1181
void actions_init(void)
Definition actions.c:850
struct requirement_vector * action_enabler_vector_by_number(const void *enabler, req_vec_num_in_item vec)
Definition actions.c:2071
double action_prob_to_0_to_1_pessimist(const struct act_prob ap)
Definition actions.c:5417
const char * gen_action_name_update_cb(const char *old_name)
Definition actions.c:7497
struct action_enabler_list * action_enablers_for_action(action_id action)
Definition actions.c:1580
bool action_distance_accepted(const struct action *action, const int distance)
Definition actions.c:1205
const char * action_get_ui_name_mnemonic(action_id act_id, const char *mnemonic)
Definition actions.c:1279
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:3410
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:249
#define MAX_LEN_NAME
Definition fc_types.h:67
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:318
Definition tile.h:50
Definition unit.h:140