Project

General

Profile

Feature #220 ยป 0036-Unhardcode-wld.map-from-pft_fill_reverse_parameter.patch

Marko Lindqvist, 02/01/2024 05:26 AM

View differences:

common/aicore/path_finding.c
struct pf_reverse_map *pf_reverse_map_new(const struct player *pplayer,
struct tile *target_tile,
int max_turns, bool omniscient,
const struct civ_map *map)
const struct civ_map *nmap)
{
struct pf_reverse_map *pfrm = fc_malloc(sizeof(struct pf_reverse_map));
struct pf_parameter *param = &pfrm->template;
......
pfrm->max_turns = max_turns;
/* Initialize the parameter. */
pft_fill_reverse_parameter(param, target_tile);
pft_fill_reverse_parameter(nmap, param, target_tile);
param->owner = pplayer;
param->omniscience = omniscient;
param->map = map;
param->map = nmap;
/* Initialize the map hash. */
pfrm->hash = pf_pos_hash_new();
......
struct pf_reverse_map *pf_reverse_map_new_for_city(const struct city *pcity,
const struct player *attacker,
int max_turns, bool omniscient,
const struct civ_map *map)
const struct civ_map *nmap)
{
return pf_reverse_map_new(attacker, city_tile(pcity), max_turns, omniscient,
map);
nmap);
}
/************************************************************************//**
common/aicore/path_finding.h
struct pf_reverse_map *pf_reverse_map_new(const struct player *pplayer,
struct tile *start_tile,
int max_turns, bool omniscient,
const struct civ_map *map)
const struct civ_map *nmap)
fc__warn_unused_result;
struct pf_reverse_map *pf_reverse_map_new_for_city(const struct city *pcity,
const struct player *attacker,
int max_turns, bool omniscient,
const struct civ_map *map)
const struct civ_map *nmap)
fc__warn_unused_result;
void pf_reverse_map_destroy(struct pf_reverse_map *prfm);
common/aicore/pf_tools.c
/************************************************************************//**
Fill default parameters for reverse map.
****************************************************************************/
void pft_fill_reverse_parameter(struct pf_parameter *parameter,
void pft_fill_reverse_parameter(const struct civ_map *nmap,
struct pf_parameter *parameter,
struct tile *target_tile)
{
memset(parameter, 0, sizeof(*parameter));
parameter->map = &(wld.map);
parameter->map = nmap;
/* We ignore refuel bases in reverse mode. */
parameter->fuel = 1;
common/aicore/pf_tools.h
const struct unit_type *punittype,
struct tile *pstart_tile,
struct player *pplayer);
void pft_fill_reverse_parameter(struct pf_parameter *parameter,
void pft_fill_reverse_parameter(const struct civ_map *nmap,
struct pf_parameter *parameter,
struct tile *target_tile);
void pft_fill_amphibious_parameter(struct pft_amphibious *parameter);
    (1-1/1)