Freeciv-3.3
|
#include "rand.h"
#include "actions.h"
#include "aiiface.h"
#include "nation.h"
#include "notify.h"
#include "plrhand.h"
#include "unithand.h"
#include "unittools.h"
#include "actiontools.h"
Go to the source code of this file.
Macros | |
#define | action_auto_perf_acquire_targets(_target_extra_) |
#define | perform_action_to(act, actor, tgtid, tgt_extra) |
Typedefs | |
typedef void(* | action_notify) (struct player *, const struct action *, struct player *, struct player *, const struct tile *, const char *) |
#define action_auto_perf_acquire_targets | ( | _target_extra_ | ) |
Definition at line 982 of file actiontools.c.
typedef void(* action_notify) (struct player *, const struct action *, struct player *, struct player *, const struct tile *, const char *) |
Definition at line 34 of file actiontools.c.
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 * | eval_output, | ||
const struct action * | eval_action, | ||
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 NULL if that didn't happen.
Note that the return value doesn't say anything about survival.
Definition at line 1003 of file actiontools.c.
Referenced by diplomat_bribe_stack(), diplomat_bribe_unit(), kill_unit(), occupy_move(), remove_city(), unit_survive_autoattack(), and upkeep_kill_unit().
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 * | eval_output, | ||
const struct action * | eval_action, | ||
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 1105 of file actiontools.c.
Referenced by unit_survive_autoattack().
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 * | eval_output, | ||
const struct action * | eval_action | ||
) |
Returns the action auto performer that the specified cause can force the specified actor to perform. Returns NULL if no such action auto performer exists.
Definition at line 952 of file actiontools.c.
Referenced by action_auto_perf_unit_do(), action_auto_perf_unit_prob(), and upkeep_kill_unit().
void action_consequence_caught | ( | const struct action * | paction, |
struct player * | offender, | ||
const struct unit_type * | offender_utype, | ||
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 NULL
Definition at line 374 of file actiontools.c.
Referenced by diplomat_get_tech(), diplomat_incite(), diplomat_infiltrate_tile(), diplomat_sabotage(), do_paradrop(), spy_nuke_city(), spy_poison(), spy_spread_plague(), spy_steal_gold(), spy_steal_some_maps(), and unit_nuke().
|
static |
Take care of any consequences (like casus belli) of the given action when the situation was as specified.
victim_player can be NULL
Definition at line 150 of file actiontools.c.
Referenced by action_consequence_caught(), action_consequence_complete(), and action_consequence_success().
void action_consequence_complete | ( | const struct action * | paction, |
struct player * | offender, | ||
const struct unit_type * | offender_utype, | ||
struct player * | victim_player, | ||
const struct tile * | victim_tile, | ||
const char * | victim_link | ||
) |
Definition at line 572 of file actiontools.c.
Referenced by update_unit_activity().
void action_consequence_success | ( | const struct action * | paction, |
struct player * | offender, | ||
const struct unit_type * | offender_utype, | ||
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.
victim_player can be NULL
Definition at line 551 of file actiontools.c.
Referenced by city_add_unit(), city_build(), diplomat_bribe_unit(), diplomat_embassy(), diplomat_get_tech(), diplomat_incite(), diplomat_investigate(), diplomat_sabotage(), do_attack(), do_capture_units(), do_conquer_extras(), do_expel_unit(), do_heal_unit(), do_paradrop(), do_unit_conquer_city(), do_unit_establish_trade(), do_unit_strike_city_building(), do_unit_strike_city_production(), do_wipe_units(), spy_attack(), spy_escape(), spy_nuke_city(), spy_poison(), spy_sabotage_unit(), spy_spread_plague(), spy_steal_gold(), spy_steal_some_maps(), unit_activity_targeted_internal(), unit_bombard(), unit_do_destroy_city(), unit_do_help_build(), unit_do_regular_move(), and unit_nuke().
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 1197 of file actiontools.c.
Referenced by diplomat_get_tech(), diplomat_incite(), diplomat_sabotage(), do_unit_strike_city_building(), do_unit_strike_city_production(), spy_nuke_city(), spy_poison(), spy_spread_plague(), spy_steal_gold(), and spy_steal_some_maps().
|
static |
Give the victim a casus belli against the offender.
Definition at line 115 of file actiontools.c.
Referenced by action_consequence_common().
Find an sub target for the specified action.
Definition at line 889 of file actiontools.c.
Referenced by execute_orders(), and unit_perform_action().
|
static |
Wipe an actor if the action it successfully performed consumed it.
Definition at line 44 of file actiontools.c.
Referenced by action_success_actor_price().
Make the actor that successfully performed the action pay the price.
Definition at line 105 of file actiontools.c.
|
static |
Pay the movement point cost of success.
Definition at line 67 of file actiontools.c.
Referenced by action_success_actor_price().
Pay the movement point price of being the target of an action.
Definition at line 80 of file actiontools.c.
struct city * action_tgt_city | ( | struct unit * | actor, |
struct tile * | target_tile, | ||
bool | accept_all_actions | ||
) |
Find a city to target for an action on the specified tile.
Returns NULL if no proper target is found.
If the only action(s) that can be performed against a target has the rare_pop_up property the target will only be considered valid if the accept_all_actions argument is TRUE.
Definition at line 640 of file actiontools.c.
Referenced by handle_unit_get_actions(), unit_move(), and unit_move_handling().
struct tile * action_tgt_tile | ( | struct unit * | actor, |
struct tile * | target, | ||
const struct extra_type * | target_extra, | ||
bool | accept_all_actions | ||
) |
Returns the tile iff it, from the point of view of the owner of the actor unit, looks like a target tile.
Returns NULL if the player knows that the actor unit can't do any action (that specifies its target as a tile) to the tile.
If the owner of the actor unit doesn't have the knowledge needed to know for sure if the unit can act the tile will be returned.
If the only action(s) that can be performed against a target has the rare_pop_up property the target will only be considered valid if the accept_all_actions argument is TRUE.
Definition at line 733 of file actiontools.c.
Referenced by unit_move_handling().
struct extra_type * action_tgt_tile_extra | ( | const struct unit * | actor, |
const struct tile * | target_tile, | ||
bool | accept_all_actions | ||
) |
Find an extra to target for an action at the specified tile.
Returns the first extra found that the actor may act against at the tile or NULL if no proper target is found. (Note that some actions requires the absence of an extra since they result in its creation while other requires its presence.)
If the only action(s) that can be performed against a target has the rare_pop_up property the target will only be considered valid if the accept_all_actions argument is TRUE.
Definition at line 872 of file actiontools.c.
Referenced by handle_unit_get_actions(), and unit_move_handling().
struct unit * action_tgt_unit | ( | struct unit * | actor, |
struct tile * | target_tile, | ||
bool | accept_all_actions | ||
) |
Find a unit to target for an action at the specified tile.
Returns the first unit found at the tile that the actor may act against or NULL if no proper target is found.
If the only action(s) that can be performed against a target has the rare_pop_up property the target will only be considered valid if the accept_all_actions argument is TRUE.
Definition at line 707 of file actiontools.c.
Referenced by execute_orders(), handle_unit_get_actions(), and unit_move_handling().
|
static |
Returns TRUE iff, from the point of view of the owner of the actor unit, it looks like the actor unit may be able to do any action to the target city.
If the owner of the actor unit doesn't have the knowledge needed to know for sure if the unit can act TRUE will be returned.
If the only action(s) that can be performed against a target has the rare_pop_up property the target will only be considered valid if the accept_all_actions argument is TRUE.
Definition at line 599 of file actiontools.c.
Referenced by action_tgt_city().
|
static |
Returns TRUE iff, from the point of view of the owner of the actor unit, it looks like the actor unit may be able to do any action to the target extra located at the target tile.
If the owner of the actor unit doesn't have the knowledge needed to know for sure if the unit can act TRUE will be returned.
If the only action(s) that can be performed against a target has the rare_pop_up property the target will only be considered valid if the accept_all_actions argument is TRUE.
Definition at line 801 of file actiontools.c.
Referenced by action_tgt_tile_extra().
|
static |
Returns TRUE iff, from the point of view of the owner of the actor unit, it looks like the actor unit may be able to do any action to the target unit.
If the owner of the actor unit doesn't have the knowledge needed to know for sure if the unit can act TRUE will be returned.
If the only action(s) that can be performed against a target has the rare_pop_up property the target will only be considered valid if the accept_all_actions argument is TRUE.
Definition at line 665 of file actiontools.c.
Referenced by action_tgt_unit().
|
static |
Notify the actor that the failed action gave the victim a casus belli against the actor.
Definition at line 210 of file actiontools.c.
Referenced by action_consequence_caught().
|
static |
Notify the actor that the performed action gave the victim a casus belli against the actor.
Definition at line 393 of file actiontools.c.
Referenced by action_consequence_complete(), and action_consequence_success().
|
static |
Notify the world that the failed action gave the everyone a casus belli against the actor.
Definition at line 326 of file actiontools.c.
Referenced by action_consequence_caught().
|
static |
Notify the world that the performed action gave the everyone a casus belli against the actor.
Definition at line 504 of file actiontools.c.
Referenced by action_consequence_complete(), and action_consequence_success().
|
static |
Notify the victim that the failed action gave the victim a casus belli against the actor.
Definition at line 267 of file actiontools.c.
Referenced by action_consequence_caught().
|
static |
Notify the victim that the performed action gave the victim a casus belli against the actor.
Definition at line 447 of file actiontools.c.
Referenced by action_consequence_complete(), and action_consequence_success().