1. Did not incorporate server changes such as UTYF_NEVER_PROTECTS, which results in AI thinking unprotected tiles can't be attacked, and bugs the goto-pathing of dumb clients who must use server side goto.
2. Did not enact the rule that unreachable units inside cities are reachable.
FIXED VERSION is below:
/************************************************************************//**
Can we attack 'ptile'? At this point, it assumes there are non-allied
units on the tile.
****************************************************************************/
static inline bool pf_attack_possible(const struct tile *ptile,
enum known_type known,
const struct pf_parameter *param)
{
bool non_allied_city;
bool attack_any;
if (!can_attack_non_native(param->utype)
&& !is_native_tile(param->utype, ptile)) {
return FALSE;
}
if (TILE_KNOWN_SEEN != known) {
/* We cannot see units, let's assume we can attack. */
return TRUE;
}
non_allied_city = is_non_allied_city_tile(ptile, param->owner);
attack_any = FALSE;
unit_list_iterate(ptile->units, punit) {
/* Any non-hostile unit will fail the whole stack*/
if (!pplayers_at_war(unit_owner(punit), param->owner)) {
return FALSE;
}
/* Hostile unit reachability test. */
if (BV_ISSET(param->utype->targets, uclass_index(unit_class_get(punit)))
|| tile_has_native_base(ptile, unit_type_get(punit))
|| non_allied_city) {
attack_any = TRUE;
} else if (game.info.unreachable_protects) {
/* We get here if punit is unreachable to utype */
if (!utype_has_flag(unit_type_get(punit), UTYF_NEVER_PROTECTS)) {
return FALSE;
}
/* NB: if there are UTYF_NEVER_PROTECTS units on the tile, 'attack_any'
has to get set TRUE at least once to enable an attack to the tile,
which is exactly correct behaviour. */
}
} unit_list_iterate_end;
return attack_any;
}
1. Did not incorporate server changes such as UTYF_NEVER_PROTECTS, which results in AI thinking unprotected tiles can't be attacked, and bugs the goto-pathing of dumb clients who must use server side goto. 2. Did not enact the rule that unreachable units inside cities are reachable.
FIXED VERSION is below: