Feature #1060 ยป 0060-pf_reverse_map_new-Take-map-as-first-parameter.patch
| ai/default/daimilitary.c | ||
|---|---|---|
|
/* Note that we still consider the units of players we are not (yet)
|
||
|
* at war with. */
|
||
|
pcity_map = pf_reverse_map_new_for_city(pcity, aplayer, assess_turns,
|
||
|
omnimap, nmap);
|
||
|
pcity_map = pf_reverse_map_new_for_city(nmap, pcity, aplayer, assess_turns,
|
||
|
omnimap);
|
||
|
if (ul_cb != NULL) {
|
||
|
units = ul_cb(aplayer);
|
||
| ai/default/daiunit.c | ||
|---|---|---|
|
UNIT_LOG(LOG_DEBUG, leader, "Barbarian leader needs to flee");
|
||
|
/* Check for units we could fear. */
|
||
|
pfrm = pf_reverse_map_new(pplayer, leader_tile, 3,
|
||
|
!has_handicap(pplayer, H_MAP), &(wld.map));
|
||
|
pfrm = pf_reverse_map_new(nmap, pplayer, leader_tile, 3,
|
||
|
!has_handicap(pplayer, H_MAP));
|
||
|
worst_danger = NULL;
|
||
|
best_move_cost = FC_INFINITY;
|
||
| common/aicore/path_finding.c | ||
|---|---|---|
|
'pf_reverse_map' constructor. If 'max_turns' is positive, then it won't
|
||
|
try to iterate the maps beyond this number of turns.
|
||
|
****************************************************************************/
|
||
|
struct pf_reverse_map *pf_reverse_map_new(const struct player *pplayer,
|
||
|
struct pf_reverse_map *pf_reverse_map_new(const struct civ_map *nmap,
|
||
|
const struct player *pplayer,
|
||
|
struct tile *target_tile,
|
||
|
int max_turns, bool omniscient,
|
||
|
const struct civ_map *nmap)
|
||
|
int max_turns, bool omniscient)
|
||
|
{
|
||
|
struct pf_reverse_map *pfrm = fc_malloc(sizeof(struct pf_reverse_map));
|
||
|
struct pf_parameter *param = &pfrm->template;
|
||
| ... | ... | |
|
'pf_reverse_map' constructor for city. If 'max_turns' is positive, then
|
||
|
it won't try to iterate the maps beyond this number of turns.
|
||
|
****************************************************************************/
|
||
|
struct pf_reverse_map *pf_reverse_map_new_for_city(const struct city *pcity,
|
||
|
struct pf_reverse_map *pf_reverse_map_new_for_city(const struct civ_map *nmap,
|
||
|
const struct city *pcity,
|
||
|
const struct player *attacker,
|
||
|
int max_turns, bool omniscient,
|
||
|
const struct civ_map *nmap)
|
||
|
int max_turns, bool omniscient)
|
||
|
{
|
||
|
return pf_reverse_map_new(attacker, city_tile(pcity), max_turns, omniscient,
|
||
|
nmap);
|
||
|
return pf_reverse_map_new(nmap, attacker, city_tile(pcity), max_turns, omniscient);
|
||
|
}
|
||
|
/************************************************************************//**
|
||
| common/aicore/path_finding.h | ||
|---|---|---|
|
/* Reverse map functions (Costs to go to start tile). */
|
||
|
struct pf_reverse_map *pf_reverse_map_new(const struct player *pplayer,
|
||
|
struct pf_reverse_map *pf_reverse_map_new(const struct civ_map *nmap,
|
||
|
const struct player *pplayer,
|
||
|
struct tile *start_tile,
|
||
|
int max_turns, bool omniscient,
|
||
|
const struct civ_map *nmap)
|
||
|
int max_turns, bool omniscient)
|
||
|
fc__warn_unused_result;
|
||
|
struct pf_reverse_map *pf_reverse_map_new_for_city(const struct city *pcity,
|
||
|
struct pf_reverse_map *pf_reverse_map_new_for_city(const struct civ_map *nmap,
|
||
|
const struct city *pcity,
|
||
|
const struct player *attacker,
|
||
|
int max_turns, bool omniscient,
|
||
|
const struct civ_map *nmap)
|
||
|
int max_turns, bool omniscient)
|
||
|
fc__warn_unused_result;
|
||
|
void pf_reverse_map_destroy(struct pf_reverse_map *prfm);
|
||