Feature #1077 ยป 0065-AI-Pass-civ_map-to-assess_danger_unit.patch
| ai/default/daimilitary.c | ||
|---|---|---|
|
/**********************************************************************//**
|
||
|
How dangerous and far a unit is for a city?
|
||
|
**************************************************************************/
|
||
|
static unsigned int assess_danger_unit(const struct city *pcity,
|
||
|
static unsigned int assess_danger_unit(const struct civ_map *nmap,
|
||
|
const struct city *pcity,
|
||
|
struct pf_reverse_map *pcity_map,
|
||
|
const struct unit *punit,
|
||
|
int *move_time)
|
||
| ... | ... | |
|
const struct unit *ferry;
|
||
|
unsigned int danger;
|
||
|
int amod = -99, dmod;
|
||
|
struct civ_map *nmap = &(wld.map);
|
||
|
bool attack_danger = FALSE;
|
||
|
*move_time = PF_IMPOSSIBLE_MC;
|
||
| ... | ... | |
|
}
|
||
|
/* Defender unspecific vulnerability and potential move time */
|
||
|
vulnerability = assess_danger_unit(pcity, pcity_map,
|
||
|
vulnerability = assess_danger_unit(nmap, pcity, pcity_map,
|
||
|
punit, &move_time);
|
||
|
if (PF_IMPOSSIBLE_MC == move_time) {
|
||