Freeciv-3.3: /fast/freeciv/nightly/main/server/actiontools.h File Reference

Freeciv-3.3

Loading...
Searching...
No Matches
Functions
actiontools.h File Reference
`#include "actions.h"`
`#include "player.h"`
`#include "tile.h"`
`#include "unit.h"`

Go to the source code of this file.

## Functions

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)
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)
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)
void | action_success_target_pay_mp (struct action *paction, int target_id, struct unit *target)
void | action_success_actor_price (struct action *paction, int actor_id, struct unit *actor)
struct city * | action_tgt_city (struct unit *actor, struct tile *target_tile, bool accept_all_actions)
struct unit * | action_tgt_unit (struct unit *actor, struct tile *target_tile, bool accept_all_actions)
struct tile * | action_tgt_tile (struct unit *actor, struct tile *target_tile, const struct extra_type *target_extra, bool accept_all_actions)
struct extra_type * | action_tgt_tile_extra (const struct unit *actor, const struct tile *target_tile, bool accept_all_actions)
int | action_sub_target_id_for_action (const struct action *paction, struct unit *actor_unit)
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)
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)
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)
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)

## 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 * | 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 998 of file actiontools.c.

Referenced by diplomat_bribe(), kill_unit(), occupy_move(), remove_city(), 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 * | 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 1100 of file actiontools.c.

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 * | 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 947 of file actiontools.c.

Referenced by action_auto_perf_unit_do(), action_auto_perf_unit_prob(), and upkeep_kill_unit().

## ◆ action_consequence_caught()

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

## ◆ action_consequence_complete()

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

## ◆ action_consequence_success()

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

## ◆ 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 1192 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().

## ◆ 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 885 of file actiontools.c.

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 105 of file actiontools.c.

## ◆ 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 80 of file actiontools.c.

## ◆ action_tgt_city()

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

## ◆ action_tgt_tile()

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

## ◆ action_tgt_tile_extra()

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 868 of file actiontools.c.

Referenced by handle_unit_get_actions(), and unit_move_handling().

## ◆ action_tgt_unit()

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