Freeciv-3.3
Loading...
Searching...
No Matches
Functions | Variables
actres.c File Reference
#include "city.h"
#include "combat.h"
#include "fc_interface.h"
#include "game.h"
#include "map.h"
#include "metaknowledge.h"
#include "movement.h"
#include "player.h"
#include "requirements.h"
#include "tile.h"
#include "traderoutes.h"
#include "actres.h"

Go to the source code of this file.

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)
 
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_sub_target_kind actres_sub_target_kind_default (enum action_result result)
 
enum action_target_kind actres_target_kind_default (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)
 
static bool plr_knows_tile (const struct player *plr, const struct tile *ttile)
 
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)
 

Variables

static struct actres act_results [ACTRES_LAST]
 

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().

◆ plr_knows_tile()

static bool plr_knows_tile ( const struct player plr,
const struct tile ttile 
)
static

Returns TRUE iff the specified player knows (has seen) the specified tile.

Definition at line 824 of file actres.c.

Referenced by actres_possible().

Variable Documentation

◆ act_results

struct actres act_results[ACTRES_LAST]
static