Freeciv21
Develop your civilization from humble roots to a global empire
actiontools.h File Reference
#include "actions.h"
#include "player.h"
#include "tile.h"
#include "unit.h"
+ Include dependency graph for actiontools.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void action_consequence_caught (const struct action *paction, struct player *offender, struct player *victim_player, const struct tile *victim_tile, const char *victim_link)
 Take care of any consequences (like casus belli) of getting caught while trying to perform the given action. More...
 
void action_consequence_success (const struct action *paction, struct player *offender, struct player *victim_player, const struct tile *victim_tile, const char *victim_link)
 Take care of any consequences (like casus belli) of successfully performing the given action. More...
 
void action_consequence_complete (const struct action *paction, struct player *offender, struct player *victim_player, const struct tile *victim_tile, const char *victim_link)
 Take care of any consequences (like casus belli) of successfully completing the given action. More...
 
void action_success_target_pay_mp (struct action *paction, int target_id, struct unit *target)
 Pay the movement point price of being the target of an action. More...
 
void action_success_actor_price (struct action *paction, int actor_id, struct unit *actor)
 Make the actor that successfully performed the action pay the price. More...
 
int action_sub_target_id_for_action (const struct action *paction, struct unit *actor_unit)
 Find an sub target for the specified action. More...
 
const struct action_auto_perfaction_auto_perf_unit_sel (const enum action_auto_perf_cause cause, const struct unit *actor, const struct player *other_player, const struct output_type *output)
 Returns the action auto performer that the specified cause can force the specified actor to perform. More...
 
const struct actionaction_auto_perf_unit_do (const enum action_auto_perf_cause cause, struct unit *actor, const struct player *other_player, const struct output_type *output, const struct tile *target_tile, const struct city *target_city, const struct unit *target_unit, const struct extra_type *target_extra)
 Make the specified actor unit perform an action because of cause. More...
 
struct act_prob action_auto_perf_unit_prob (const enum action_auto_perf_cause cause, struct unit *actor, const struct player *other_player, const struct output_type *output, const struct tile *target_tile, const struct city *target_city, const struct unit *target_unit, const struct extra_type *target_extra)
 Returns the probability for the specified actor unit to be forced to perform an action by the specified cause. More...
 
bool action_failed_dice_roll (const struct player *act_player, const struct unit *act_unit, const struct city *tgt_city, const struct player *tgt_player, const struct action *paction)
 Returns TRUE iff the spy/diplomat was caught outside of a diplomatic battle. More...
 

Function Documentation

◆ action_auto_perf_unit_do()

const struct action* action_auto_perf_unit_do ( const enum action_auto_perf_cause  cause,
struct unit actor,
const struct player other_player,
const struct output_type output,
const struct tile target_tile,
const struct city target_city,
const struct unit target_unit,
const struct extra_type target_extra 
)

Make the specified actor unit perform an action because of cause.

Returns the action the actor unit was forced to perform. Returns nullptr if that didn't happen.

Note that the return value doesn't say anything about survival.

Definition at line 631 of file actiontools.cpp.

Referenced by unit_survive_autoattack(), and upkeep_kill_unit().

◆ action_auto_perf_unit_prob()

struct act_prob action_auto_perf_unit_prob ( const enum action_auto_perf_cause  cause,
struct unit actor,
const struct player other_player,
const struct output_type output,
const struct tile target_tile,
const struct city target_city,
const struct unit target_unit,
const struct extra_type target_extra 
)

Returns the probability for the specified actor unit to be forced to perform an action by the specified cause.

Definition at line 631 of file actiontools.cpp.

Referenced by unit_survive_autoattack().

◆ action_auto_perf_unit_sel()

const struct action_auto_perf* action_auto_perf_unit_sel ( const enum action_auto_perf_cause  cause,
const struct unit actor,
const struct player other_player,
const struct output_type output 
)

Returns the action auto performer that the specified cause can force the specified actor to perform.

Returns nullptr if no such action auto performer exists.

Definition at line 592 of file actiontools.cpp.

Referenced by action_auto_perf_unit_do(), and upkeep_kill_unit().

◆ action_consequence_caught()

void action_consequence_caught ( const struct action paction,
struct player offender,
struct player victim_player,
const struct tile victim_tile,
const char *  victim_link 
)

Take care of any consequences (like casus belli) of getting caught while trying to perform the given action.

victim_player can be nullptr

Definition at line 337 of file actiontools.cpp.

Referenced by diplomat_get_tech(), diplomat_incite(), diplomat_infiltrate_tile(), diplomat_sabotage(), spy_nuke_city(), spy_spread_plague(), spy_steal_gold(), spy_steal_some_maps(), and unit_nuke().

◆ action_consequence_complete()

void action_consequence_complete ( const struct action paction,
struct player offender,
struct player victim_player,
const struct tile victim_tile,
const char *  victim_link 
)

Take care of any consequences (like casus belli) of successfully completing the given action.

victim_player can be nullptr

Definition at line 514 of file actiontools.cpp.

Referenced by unit_activity_complete().

◆ action_consequence_success()

void action_consequence_success ( const struct action paction,
struct player offender,
struct player victim_player,
const struct tile victim_tile,
const char *  victim_link 
)

◆ action_failed_dice_roll()

bool action_failed_dice_roll ( const struct player act_player,
const struct unit act_unit,
const struct city tgt_city,
const struct player tgt_player,
const struct action paction 
)

Returns TRUE iff the spy/diplomat was caught outside of a diplomatic battle.

Definition at line 797 of file actiontools.cpp.

Referenced by diplomat_get_tech(), diplomat_incite(), diplomat_sabotage(), do_unit_strike_city_building(), do_unit_strike_city_production(), spy_nuke_city(), spy_spread_plague(), spy_steal_gold(), and spy_steal_some_maps().

◆ action_sub_target_id_for_action()

int action_sub_target_id_for_action ( const struct action paction,
struct unit actor_unit 
)

Find an sub target for the specified action.

Definition at line 529 of file actiontools.cpp.

Referenced by execute_orders(), and unit_perform_action().

◆ action_success_actor_price()

void action_success_actor_price ( struct action paction,
int  actor_id,
struct unit actor 
)

Make the actor that successfully performed the action pay the price.

Definition at line 88 of file actiontools.cpp.

◆ action_success_target_pay_mp()

void action_success_target_pay_mp ( struct action paction,
int  target_id,
struct unit target 
)

Pay the movement point price of being the target of an action.

Definition at line 70 of file actiontools.cpp.