Project

General

Profile

Bug #1695 » 0059-invasion_funct-Assert-goto-tile-validity.patch

Marko Lindqvist, 01/08/2026 01:06 AM

View differences:

ai/default/daiunit.c
If dest is TRUE then a valid goto is presumed.
**************************************************************************/
static void invasion_funct(struct ai_type *ait, struct unit *punit,
static bool invasion_funct(struct ai_type *ait, struct unit *punit,
bool dest, int radius, int which)
{
struct tile *ptile;
......
CHECK_UNIT(punit);
if (dest) {
fc_assert_ret_val(punit->goto_tile != NULL, FALSE);
ptile = punit->goto_tile;
} else {
ptile = unit_tile(punit);
......
} unit_cargo_iterate_end;
}
} square_iterate_end;
return TRUE;
}
/**********************************************************************//**
......
/* Dealing with invasion stuff */
if (IS_ATTACKER(atype)) {
if (aunit->activity == ACTIVITY_GOTO) {
invasion_funct(ait, aunit, TRUE, 0,
(unit_can_take_over(aunit)
? INVASION_OCCUPY : INVASION_ATTACK));
if ((pcity = tile_city(aunit->goto_tile))) {
if (invasion_funct(ait, aunit, TRUE, 0,
(unit_can_take_over(aunit)
? INVASION_OCCUPY : INVASION_ATTACK))
&& (pcity = tile_city(aunit->goto_tile))) {
struct ai_city *city_data = def_ai_city_data(pcity, ait);
city_data->attack += adv_unit_att_rating(aunit);
(2-2/2)