Freeciv-3.3
|
#include <string.h>
#include "bitvector.h"
#include "log.h"
#include "mem.h"
#include "base.h"
#include "combat.h"
#include "game.h"
#include "movement.h"
#include "tile.h"
#include "unit.h"
#include "unittype.h"
#include "aiactions.h"
#include "pf_tools.h"
Go to the source code of this file.
|
static |
A callback for amphibious movement
Definition at line 542 of file pf_tools.c.
Referenced by pft_fill_amphibious_parameter().
|
static |
Extra cost call back for amphibious movement
Definition at line 453 of file pf_tools.c.
Referenced by pft_fill_amphibious_parameter().
|
static |
Position-dangerous callback for amphibious movement.
Definition at line 662 of file pf_tools.c.
Referenced by pft_fill_amphibious_parameter().
|
static |
A cost function for amphibious movement.
Definition at line 403 of file pf_tools.c.
Referenced by pft_fill_amphibious_parameter().
|
static |
A cost function for amphibious movement.
Definition at line 304 of file pf_tools.c.
Referenced by pft_fill_amphibious_parameter().
|
static |
Check if there is a safe position to move.
Definition at line 613 of file pf_tools.c.
Referenced by get_fuel_moves_left_req().
|
static |
Position-dangerous callback for air units.
Definition at line 638 of file pf_tools.c.
Referenced by pft_fill_attack_param(), pft_fill_overlap_param(), and pft_fill_parameter().
|
static |
Refueling base for air units.
Definition at line 562 of file pf_tools.c.
Referenced by get_closest_safe_tile_distance(), and get_fuel_moves_left_req().
enum tile_behavior no_fights | ( | const struct tile * | ptile, |
enum known_type | known, | ||
const struct pf_parameter * | param | ||
) |
PF callback to prohibit attacking anyone.
Definition at line 510 of file pf_tools.c.
Referenced by dai_fill_unit_param().
enum tile_behavior no_fights_or_unknown | ( | const struct tile * | ptile, |
enum known_type | known, | ||
const struct pf_parameter * | param | ||
) |
PF callback to prohibit going into the unknown. Also makes sure we don't plan to attack anyone.
Definition at line 493 of file pf_tools.c.
Referenced by find_best_city_placement(), manage_auto_explorer(), and no_fights_or_unknown_goto().
enum tile_behavior no_intermediate_fights | ( | const struct tile * | ptile, |
enum known_type | known, | ||
const struct pf_parameter * | param | ||
) |
PF callback to prohibit attacking anyone, except at the destination.
Definition at line 526 of file pf_tools.c.
Referenced by dai_fill_unit_param(), and dai_manage_diplomat().
|
static |
A cost function for regular movement. Permits attacks. Use with a TB callback to prevent passing through occupied tiles. Does not permit passing through non-native tiles without transport.
Definition at line 364 of file pf_tools.c.
Referenced by pft_fill_attack_param(), pft_fill_parameter(), and pft_fill_reverse_parameter().
|
static |
A cost function for overlap movement. Do not consider enemy units and attacks. Permits moves one step into non-native terrain (for ferries, etc.) Use with a TB callback to prevent passing through occupied tiles. Does not permit passing through non-native tiles without transport.
Definition at line 384 of file pf_tools.c.
Referenced by pft_fill_overlap_param().
|
static |
Determines if an action is possible from 'src' to 'dst': attack, diplomat action, or caravan action.
Definition at line 140 of file pf_tools.c.
Referenced by pft_enable_default_actions().
|
inlinestatic |
Can we attack 'ptile'? At this point, it assumes there are non-allied units on the tile.
Definition at line 45 of file pf_tools.c.
Referenced by pf_get_action().
|
static |
Determines if a path to 'ptile' would be considered as action rather than normal move: attack, diplomat action, caravan action.
FIXME: For diplomat actions, we should take in account action enablers.
Definition at line 96 of file pf_tools.c.
Referenced by pft_enable_default_actions().
|
static |
Determine how it is possible to move from/to 'ptile'. The checks for specific move from tile to tile is done in pf_move_possible().
Definition at line 228 of file pf_tools.c.
Referenced by amphibious_move_scope(), pft_fill_default_parameter(), and pft_fill_reverse_parameter().
|
inlinestatic |
Determines if the move between two tiles is possible. Do not use this function as part of a test of whether a unit may attack a tile: many tiles that pass this test may be unsuitable for some units to attack to/from.
Does not check if the tile is occupied by non-allied units.
Definition at line 335 of file pf_tools.c.
Referenced by normal_move(), and overlap_move().
|
static |
Special case for reverse maps. Always consider the target tile as attackable, notably for transports.
Definition at line 167 of file pf_tools.c.
Referenced by pft_fill_reverse_parameter().
|
inlinestatic |
Determine if we could load into 'ptrans' and its parents.
Definition at line 177 of file pf_tools.c.
Referenced by is_possible_base_fuel(), and pf_get_move_scope().
|
inlinestatic |
Enable default actions.
Definition at line 707 of file pf_tools.c.
Referenced by pft_fill_attack_param(), and pft_fill_parameter().
void pft_fill_amphibious_parameter | ( | struct pft_amphibious * | parameter | ) |
Fill parameters for combined sea-land movement. This is suitable for the case of a land unit riding a ferry. The starting position of the ferry is taken to be the starting position for the PF. The passenger is assumed initially to be on the given ferry. The destination may be inland, in which case the passenger will ride the ferry to a beach head, disembark, then continue on land. One complexity of amphibious movement is that the movement rate on land might be different from that at sea. We therefore scale up the movement rates (and the corresponding movement consts) to the product of the two rates.
Definition at line 997 of file pf_tools.c.
|
static |
pft_fill_*_attack_param() base function.
Consider attacking and non-attacking possibilities properly.
Definition at line 907 of file pf_tools.c.
Referenced by pft_fill_unit_attack_param(), and pft_fill_utype_attack_param().
|
inlinestatic |
Fill general use parameters to defaults.
Definition at line 684 of file pf_tools.c.
Referenced by pft_fill_unit_default_parameter(), and pft_fill_utype_default_parameter().
|
static |
pft_fill_*_overlap_param() base function.
Switch on one tile overlapping into the non-native terrain. For sea/land bombardment and for ferries.
Definition at line 857 of file pf_tools.c.
Referenced by pft_fill_unit_overlap_param(), and pft_fill_utype_overlap_param().
|
inlinestatic |
Base function to fill classic parameters.
Definition at line 807 of file pf_tools.c.
Referenced by pft_fill_unit_parameter(), and pft_fill_utype_parameter().
void pft_fill_reverse_parameter | ( | const struct civ_map * | nmap, |
struct pf_parameter * | parameter, | ||
struct tile * | target_tile | ||
) |
Fill default parameters for reverse map.
Definition at line 963 of file pf_tools.c.
Referenced by pf_reverse_map_new().
void pft_fill_unit_attack_param | ( | struct pf_parameter * | parameter, |
const struct civ_map * | nmap, | ||
const struct unit * | punit | ||
) |
pft_fill_*_attack_param() base function.
Consider attacking and non-attacking possibilities properly.
Definition at line 952 of file pf_tools.c.
Referenced by dai_fill_unit_param(), find_rampage_target(), find_something_to_kill(), and goto_is_sane().
|
inlinestatic |
Fill general use parameters to defaults for an unit.
Definition at line 773 of file pf_tools.c.
Referenced by pft_fill_unit_attack_param(), pft_fill_unit_overlap_param(), and pft_fill_unit_parameter().
void pft_fill_unit_overlap_param | ( | struct pf_parameter * | parameter, |
const struct civ_map * | nmap, | ||
const struct unit * | punit | ||
) |
Switch on one tile overlapping into the non-native terrain. For sea/land bombardment and for ferries.
Definition at line 894 of file pf_tools.c.
Referenced by dai_fill_unit_param(), find_best_city_placement(), and find_something_to_kill().
void pft_fill_unit_parameter | ( | struct pf_parameter * | parameter, |
const struct civ_map * | nmap, | ||
const struct unit * | punit | ||
) |
Fill classic parameters for an unit.
Definition at line 843 of file pf_tools.c.
Referenced by auto_worker_setup_work(), calculate_city_clusters(), caravan_search_from(), dai_choose_diplomat_offensive(), dai_fill_unit_param(), dai_find_strategic_airbase(), dai_hunter_manage(), dai_hunter_try_launch(), dai_manage_barbarian_leader(), dai_manage_diplomat(), dai_unit_can_strike_my_unit(), dai_wonder_city_distance(), explorer_goto(), find_best_city_placement(), find_nearest_airbase(), find_nearest_safe_city(), find_something_to_bomb(), goto_fill_parameter_base(), immediate_destination(), look_for_charge(), manage_auto_explorer(), player_restore_units(), worker_evaluate_city_requests(), and worker_evaluate_improvements().
void pft_fill_utype_attack_param | ( | struct pf_parameter * | parameter, |
const struct civ_map * | nmap, | ||
const struct unit_type * | punittype, | ||
struct tile * | pstart_tile, | ||
struct player * | pplayer | ||
) |
pft_fill_*_attack_param() base function.
Consider attacking and non-attacking possibilities properly.
Definition at line 936 of file pf_tools.c.
|
inlinestatic |
Fill general use parameters to defaults for an unit type.
Definition at line 735 of file pf_tools.c.
Referenced by pft_fill_utype_attack_param(), pft_fill_utype_overlap_param(), and pft_fill_utype_parameter().
void pft_fill_utype_overlap_param | ( | struct pf_parameter * | parameter, |
const struct civ_map * | nmap, | ||
const struct unit_type * | punittype, | ||
struct tile * | pstart_tile, | ||
struct player * | pplayer | ||
) |
Switch on one tile overlapping into the non-native terrain. For sea/land bombardment and for ferry types.
Definition at line 879 of file pf_tools.c.
Referenced by find_something_to_kill().
void pft_fill_utype_parameter | ( | struct pf_parameter * | parameter, |
const struct civ_map * | nmap, | ||
const struct unit_type * | punittype, | ||
struct tile * | pstart_tile, | ||
struct player * | pplayer | ||
) |
Fill classic parameters for an unit type.
Definition at line 829 of file pf_tools.c.
Referenced by process_attacker_want().