![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include "rand.h"#include "actions.h"#include "nation.h"#include "aiiface.h"#include "notify.h"#include "plrhand.h"#include "unithand.h"#include "unittools.h"#include "actiontools.h"
Include dependency graph for actiontools.cpp: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 *) |
Functions | |
| static void | action_success_actor_consume (struct action *paction, int actor_id, struct unit *actor) |
| Wipe an actor if the action it successfully performed consumed it. More... | |
| static void | action_success_pay_mp (struct action *paction, int actor_id, struct unit *actor) |
| Pay the movement point cost of success. 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... | |
| static void | action_give_casus_belli (struct player *offender, struct player *victim_player, const bool int_outrage) |
| Give the victim a casus belli against the offender. More... | |
| static void | action_consequence_common (const struct action *paction, struct player *offender, struct player *victim_player, const struct tile *victim_tile, const char *victim_link, const action_notify notify_actor, const action_notify notify_victim, const action_notify notify_global, const enum effect_type eft) |
| Take care of any consequences (like casus belli) of the given action when the situation was as specified. More... | |
| static void | notify_actor_caught (struct player *receiver, const struct action *paction, struct player *offender, struct player *victim_player, const struct tile *victim_tile, const char *victim_link) |
| Notify the actor that the failed action gave the victim a casus belli against the actor. More... | |
| static void | notify_victim_caught (struct player *receiver, const struct action *paction, struct player *offender, struct player *victim_player, const struct tile *victim_tile, const char *victim_link) |
| Notify the victim that the failed action gave the victim a casus belli against the actor. More... | |
| static void | notify_global_caught (struct player *receiver, const struct action *paction, struct player *offender, struct player *victim_player, const struct tile *victim_tile, const char *victim_link) |
| Notify the world that the failed action gave the everyone a casus belli against the actor. More... | |
| 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... | |
| static void | notify_actor_success (struct player *receiver, const struct action *paction, struct player *offender, struct player *victim_player, const struct tile *victim_tile, const char *victim_link) |
| Notify the actor that the performed action gave the victim a casus belli against the actor. More... | |
| static void | notify_victim_success (struct player *receiver, const struct action *paction, struct player *offender, struct player *victim_player, const struct tile *victim_tile, const char *victim_link) |
| Notify the victim that the performed action gave the victim a casus belli against the actor. More... | |
| static void | notify_global_success (struct player *receiver, const struct action *paction, struct player *offender, struct player *victim_player, const struct tile *victim_tile, const char *victim_link) |
| Notify the world that the performed action gave the everyone a casus belli against the actor. 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... | |
| 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_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. More... | |
| 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. 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... | |
| #define action_auto_perf_acquire_targets | ( | _target_extra_ | ) |
Definition at line 612 of file actiontools.cpp.
| #define perform_action_to | ( | act, | |
| actor, | |||
| tgtid, | |||
| tgt_extra | |||
| ) |
| typedef void(* action_notify) (struct player *, const struct action *, struct player *, struct player *, const struct tile *, const char *) |
Definition at line 27 of file actiontools.cpp.
| 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().
| 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().
| 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().
| 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().
|
static |
Take care of any consequences (like casus belli) of the given action when the situation was as specified.
victim_player can be nullptr
Definition at line 134 of file actiontools.cpp.
Referenced by action_consequence_caught(), action_consequence_complete(), and action_consequence_success().
| 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().
| 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.
victim_player can be nullptr
Definition at line 496 of file actiontools.cpp.
Referenced by city_add_unit(), city_build(), diplomat_bribe(), diplomat_embassy(), diplomat_get_tech(), diplomat_incite(), diplomat_investigate(), diplomat_sabotage(), do_attack(), do_capture_units(), do_expel_unit(), do_heal_unit(), do_unit_conquer_city(), do_unit_establish_trade(), spy_attack(), 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(), 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 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().
|
static |
Give the victim a casus belli against the offender.
Definition at line 98 of file actiontools.cpp.
Referenced by action_consequence_common().
Find an sub target for the specified action.
Definition at line 529 of file actiontools.cpp.
Referenced by execute_orders(), and unit_perform_action().
|
static |
Wipe an actor if the action it successfully performed consumed it.
Definition at line 34 of file actiontools.cpp.
Referenced by action_success_actor_price().
Make the actor that successfully performed the action pay the price.
Definition at line 88 of file actiontools.cpp.
|
static |
Pay the movement point cost of success.
Definition at line 57 of file actiontools.cpp.
Referenced by action_success_actor_price().
Pay the movement point price of being the target of an action.
Definition at line 70 of file actiontools.cpp.
|
static |
Notify the actor that the failed action gave the victim a casus belli against the actor.
Definition at line 193 of file actiontools.cpp.
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 354 of file actiontools.cpp.
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 296 of file actiontools.cpp.
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 453 of file actiontools.cpp.
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 243 of file actiontools.cpp.
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 400 of file actiontools.cpp.
Referenced by action_consequence_complete(), and action_consequence_success().