Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions
actres.h File Reference
#include "fc_types.h"
#include "world_object.h"
#include "specenum_gen.h"

Go to the source code of this file.

Data Structures

struct  actres
 

Macros

#define ASSERT_UNUSED_ACTRES_CASES   \
 
#define SPECENUM_NAME   action_target_kind
 
#define SPECENUM_VALUE0   ATK_CITY
 
#define SPECENUM_VALUE0NAME   "City"
 
#define SPECENUM_VALUE1   ATK_UNIT
 
#define SPECENUM_VALUE1NAME   "Unit"
 
#define SPECENUM_VALUE2   ATK_STACK
 
#define SPECENUM_VALUE2NAME   "Stack"
 
#define SPECENUM_VALUE3   ATK_TILE
 
#define SPECENUM_VALUE3NAME   "Tile"
 
#define SPECENUM_VALUE4   ATK_EXTRAS
 
#define SPECENUM_VALUE4NAME   "Extras"
 
#define SPECENUM_VALUE5   ATK_SELF
 
#define SPECENUM_VALUE5NAME   "Self"
 
#define SPECENUM_COUNT   ATK_COUNT
 
#define SPECENUM_NAME   action_sub_target_kind
 
#define SPECENUM_VALUE0   ASTK_NONE
 
#define SPECENUM_VALUE0NAME   N_("nothing")
 
#define SPECENUM_VALUE1   ASTK_BUILDING
 
#define SPECENUM_VALUE1NAME   N_("buildings in")
 
#define SPECENUM_VALUE2   ASTK_TECH
 
#define SPECENUM_VALUE2NAME   N_("techs from")
 
#define SPECENUM_VALUE3   ASTK_EXTRA
 
#define SPECENUM_VALUE3NAME   N_("extras on")
 
#define SPECENUM_VALUE4   ASTK_EXTRA_NOT_THERE
 
#define SPECENUM_VALUE4NAME   N_("create extras on")
 
#define SPECENUM_COUNT   ASTK_COUNT
 
#define SPECENUM_NAME   act_tgt_compl
 
#define SPECENUM_VALUE0   ACT_TGT_COMPL_SIMPLE
 
#define SPECENUM_VALUE0NAME   N_("simple")
 
#define SPECENUM_VALUE1   ACT_TGT_COMPL_FLEXIBLE
 
#define SPECENUM_VALUE1NAME   N_("flexible")
 
#define SPECENUM_VALUE2   ACT_TGT_COMPL_MANDATORY
 
#define SPECENUM_VALUE2NAME   N_("mandatory")
 
#define SPECENUM_NAME   action_battle_kind
 
#define SPECENUM_VALUE0   ABK_NONE
 
#define SPECENUM_VALUE0NAME   N_("no battle")
 
#define SPECENUM_VALUE1   ABK_STANDARD
 
#define SPECENUM_VALUE1NAME   N_("battle")
 
#define SPECENUM_VALUE2   ABK_DIPLOMATIC
 
#define SPECENUM_VALUE2NAME   N_("diplomatic battle")
 
#define SPECENUM_COUNT   ABK_COUNT
 

Enumerations

enum  dice_roll_type { DRT_NONE , DRT_DIPLCHANCE , DRT_CERTAIN }
 

Functions

void actres_init (void)
 
void actres_free (void)
 
enum act_tgt_compl actres_target_compl_calc (enum action_result result)
 
enum action_battle_kind actres_get_battle_kind (enum action_result result)
 
bool actres_is_hostile (enum action_result result)
 
enum unit_activity actres_activity_result (enum action_result result)
 
int actres_get_act_time (enum action_result result, const struct unit *actor_unit, const struct tile *tgt_tile, const struct extra_type *tgt_extra)
 
enum dice_roll_type actres_dice_type (enum action_result result)
 
bool actres_creates_extra (enum action_result result, const struct extra_type *pextra)
 
bool actres_removes_extra (enum action_result result, const struct extra_type *pextra)
 
enum fc_tristate actres_possible (const struct civ_map *nmap, enum action_result result, const struct req_context *actor, const struct req_context *target, const struct extra_type *target_extra, enum fc_tristate def, bool omniscient, const struct city *homecity)
 
int actres_min_range_default (enum action_result result)
 
int actres_max_range_default (enum action_result result)
 
bool actres_legal_target_kind (enum action_result result, enum action_target_kind tgt_kind)
 
enum action_target_kind actres_target_kind_default (enum action_result result)
 
enum action_sub_target_kind actres_sub_target_kind_default (enum action_result result)
 

Macro Definition Documentation

◆ ASSERT_UNUSED_ACTRES_CASES

#define ASSERT_UNUSED_ACTRES_CASES   \

Definition at line 37 of file actres.h.

◆ SPECENUM_COUNT [1/3]

#define SPECENUM_COUNT   ATK_COUNT

Definition at line 54 of file actres.h.

◆ SPECENUM_COUNT [2/3]

#define SPECENUM_COUNT   ASTK_COUNT

Definition at line 54 of file actres.h.

◆ SPECENUM_COUNT [3/3]

#define SPECENUM_COUNT   ABK_COUNT

Definition at line 54 of file actres.h.

◆ SPECENUM_NAME [1/4]

Definition at line 40 of file actres.h.

◆ SPECENUM_NAME [2/4]

Definition at line 40 of file actres.h.

◆ SPECENUM_NAME [3/4]

Definition at line 40 of file actres.h.

◆ SPECENUM_NAME [4/4]

Definition at line 40 of file actres.h.

◆ SPECENUM_VALUE0 [1/4]

#define SPECENUM_VALUE0   ATK_CITY

Definition at line 41 of file actres.h.

◆ SPECENUM_VALUE0 [2/4]

#define SPECENUM_VALUE0   ASTK_NONE

Definition at line 41 of file actres.h.

◆ SPECENUM_VALUE0 [3/4]

#define SPECENUM_VALUE0   ACT_TGT_COMPL_SIMPLE

Definition at line 41 of file actres.h.

◆ SPECENUM_VALUE0 [4/4]

#define SPECENUM_VALUE0   ABK_NONE

Definition at line 41 of file actres.h.

◆ SPECENUM_VALUE0NAME [1/4]

#define SPECENUM_VALUE0NAME   "City"

Definition at line 42 of file actres.h.

◆ SPECENUM_VALUE0NAME [2/4]

#define SPECENUM_VALUE0NAME   N_("nothing")

Definition at line 42 of file actres.h.

◆ SPECENUM_VALUE0NAME [3/4]

#define SPECENUM_VALUE0NAME   N_("simple")

Definition at line 42 of file actres.h.

◆ SPECENUM_VALUE0NAME [4/4]

#define SPECENUM_VALUE0NAME   N_("no battle")

Definition at line 42 of file actres.h.

◆ SPECENUM_VALUE1 [1/4]

#define SPECENUM_VALUE1   ATK_UNIT

Definition at line 43 of file actres.h.

◆ SPECENUM_VALUE1 [2/4]

#define SPECENUM_VALUE1   ASTK_BUILDING

Definition at line 43 of file actres.h.

◆ SPECENUM_VALUE1 [3/4]

#define SPECENUM_VALUE1   ACT_TGT_COMPL_FLEXIBLE

Definition at line 43 of file actres.h.

◆ SPECENUM_VALUE1 [4/4]

#define SPECENUM_VALUE1   ABK_STANDARD

Definition at line 43 of file actres.h.

◆ SPECENUM_VALUE1NAME [1/4]

#define SPECENUM_VALUE1NAME   "Unit"

Definition at line 44 of file actres.h.

◆ SPECENUM_VALUE1NAME [2/4]

#define SPECENUM_VALUE1NAME   N_("buildings in")

Definition at line 44 of file actres.h.

◆ SPECENUM_VALUE1NAME [3/4]

#define SPECENUM_VALUE1NAME   N_("flexible")

Definition at line 44 of file actres.h.

◆ SPECENUM_VALUE1NAME [4/4]

#define SPECENUM_VALUE1NAME   N_("battle")

Definition at line 44 of file actres.h.

◆ SPECENUM_VALUE2 [1/4]

#define SPECENUM_VALUE2   ATK_STACK

Definition at line 45 of file actres.h.

◆ SPECENUM_VALUE2 [2/4]

#define SPECENUM_VALUE2   ASTK_TECH

Definition at line 45 of file actres.h.

◆ SPECENUM_VALUE2 [3/4]

#define SPECENUM_VALUE2   ACT_TGT_COMPL_MANDATORY

Definition at line 45 of file actres.h.

◆ SPECENUM_VALUE2 [4/4]

#define SPECENUM_VALUE2   ABK_DIPLOMATIC

Definition at line 45 of file actres.h.

◆ SPECENUM_VALUE2NAME [1/4]

#define SPECENUM_VALUE2NAME   "Stack"

Definition at line 46 of file actres.h.

◆ SPECENUM_VALUE2NAME [2/4]

#define SPECENUM_VALUE2NAME   N_("techs from")

Definition at line 46 of file actres.h.

◆ SPECENUM_VALUE2NAME [3/4]

#define SPECENUM_VALUE2NAME   N_("mandatory")

Definition at line 46 of file actres.h.

◆ SPECENUM_VALUE2NAME [4/4]

#define SPECENUM_VALUE2NAME   N_("diplomatic battle")

Definition at line 46 of file actres.h.

◆ SPECENUM_VALUE3 [1/2]

#define SPECENUM_VALUE3   ATK_TILE

Definition at line 47 of file actres.h.

◆ SPECENUM_VALUE3 [2/2]

#define SPECENUM_VALUE3   ASTK_EXTRA

Definition at line 47 of file actres.h.

◆ SPECENUM_VALUE3NAME [1/2]

#define SPECENUM_VALUE3NAME   "Tile"

Definition at line 48 of file actres.h.

◆ SPECENUM_VALUE3NAME [2/2]

#define SPECENUM_VALUE3NAME   N_("extras on")

Definition at line 48 of file actres.h.

◆ SPECENUM_VALUE4 [1/2]

#define SPECENUM_VALUE4   ATK_EXTRAS

Definition at line 49 of file actres.h.

◆ SPECENUM_VALUE4 [2/2]

#define SPECENUM_VALUE4   ASTK_EXTRA_NOT_THERE

Definition at line 49 of file actres.h.

◆ SPECENUM_VALUE4NAME [1/2]

#define SPECENUM_VALUE4NAME   "Extras"

Definition at line 50 of file actres.h.

◆ SPECENUM_VALUE4NAME [2/2]

#define SPECENUM_VALUE4NAME   N_("create extras on")

Definition at line 50 of file actres.h.

◆ SPECENUM_VALUE5

#define SPECENUM_VALUE5   ATK_SELF

Definition at line 52 of file actres.h.

◆ SPECENUM_VALUE5NAME

#define SPECENUM_VALUE5NAME   "Self"

Definition at line 53 of file actres.h.

Enumeration Type Documentation

◆ dice_roll_type

Enumerator
DRT_NONE 
DRT_DIPLCHANCE 
DRT_CERTAIN 

Definition at line 107 of file actres.h.

Function Documentation

◆ actres_activity_result()

enum unit_activity actres_activity_result ( enum action_result  result)

Map actres to an activity that gets started.

Parameters
resultAction result to map to activity
Returns
Unit activity that the action starts

Definition at line 301 of file actres.c.

Referenced by action_new(), and actres_get_act_time().

◆ actres_creates_extra()

bool actres_creates_extra ( enum action_result  result,
const struct extra_type pextra 
)

Does action with the result create the extra

Parameters
resultAction result to check
pextraExtra to check
Returns
Whether action creates the extra

Definition at line 789 of file actres.c.

Referenced by go_act_menu::create(), execute_orders(), helptext_unit(), real_menus_init(), real_menus_update(), unit_order_list_is_sane(), and utype_can_create_extra().

◆ actres_dice_type()

enum dice_roll_type actres_dice_type ( enum action_result  result)

Map actres to initial odds type.

Parameters
resultAction result to check odds for
Returns
Initial odds type

Definition at line 364 of file actres.c.

Referenced by action_dice_roll_initial_odds().

◆ actres_free()

void actres_free ( void  )

Free resources allocated by the action results system

Definition at line 250 of file actres.c.

Referenced by game_ruleset_free().

◆ actres_get_act_time()

int actres_get_act_time ( enum action_result  result,
const struct unit actor_unit,
const struct tile tgt_tile,
const struct extra_type tgt_extra 
)

Returns the unit activity time (work) this action takes (requires) or ACT_TIME_INSTANTANEOUS if the action happens at once.

See update_unit_activity() and tile_activity_time()

Definition at line 316 of file actres.c.

◆ actres_get_battle_kind()

enum action_battle_kind actres_get_battle_kind ( enum action_result  result)

Get the battle kind that can prevent an action.

Definition at line 272 of file actres.c.

Referenced by action_prob_battle_then_dice_roll(), and helptext_unit().

◆ actres_init()

void actres_init ( void  )

Initialize action results system

Definition at line 243 of file actres.c.

Referenced by game_ruleset_init().

◆ actres_is_hostile()

bool actres_is_hostile ( enum action_result  result)

Returns TRUE iff the specified action result indicates hostile action.

Definition at line 286 of file actres.c.

Referenced by local_dipl_rel_action_cache_set(), local_dipl_rel_tile_other_tgt_action_cache_set(), tgt_citytile_act_cache_set(), unit_can_act_cache_set(), and unit_state_action_cache_set().

◆ actres_legal_target_kind()

bool actres_legal_target_kind ( enum action_result  result,
enum action_target_kind  tgt_kind 
)

Returns TRUE iff the specified action result works with the specified action target kind.

Definition at line 560 of file actres.c.

Referenced by sanity_check_ruleset_data().

◆ actres_max_range_default()

int actres_max_range_default ( enum action_result  result)

Return default max range for the action if it is ruleset settable.

Definition at line 466 of file actres.c.

Referenced by load_action_range_max(), and save_action_max_range().

◆ actres_min_range_default()

int actres_min_range_default ( enum action_result  result)

Return default min range for the action if it is ruleset settable.

Definition at line 376 of file actres.c.

Referenced by load_action_range(), and save_action_range().

◆ actres_possible()

enum fc_tristate actres_possible ( const struct civ_map nmap,
enum action_result  result,
const struct req_context actor,
const struct req_context target,
const struct extra_type target_extra,
enum fc_tristate  def,
bool  omniscient,
const struct city homecity 
)

Could an action with this kind of result be made?

Definition at line 835 of file actres.c.

Referenced by is_action_possible().

◆ actres_removes_extra()

bool actres_removes_extra ( enum action_result  result,
const struct extra_type pextra 
)

Does action with the result remove the extra

Parameters
resultAction result to check
pextraExtra to check
Returns
Whether action removes the extra

Definition at line 810 of file actres.c.

Referenced by go_act_menu::create(), execute_orders(), helptext_unit(), real_menus_init(), real_menus_update(), unit_order_list_is_sane(), and utype_can_remove_extra().

◆ actres_sub_target_kind_default()

enum action_sub_target_kind actres_sub_target_kind_default ( enum action_result  result)

Return default sub target kind for the action with the specified result.

Definition at line 672 of file actres.c.

Referenced by action_new().

◆ actres_target_compl_calc()

enum act_tgt_compl actres_target_compl_calc ( enum action_result  result)

Returns the sub target complexity for the action with the specified result when it has the specified target kind and sub target kind.

Definition at line 258 of file actres.c.

Referenced by action_new().

◆ actres_target_kind_default()

enum action_target_kind actres_target_kind_default ( enum action_result  result)

Return default target kind for the action with the specified result.

Definition at line 770 of file actres.c.

Referenced by action_new(), and load_action_kind().