Freeciv-3.1: /fast/freeciv/nightly/S3_1/common/actions.h Source File

Freeciv-3.1

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