From 5b5fc0063cc67f5b0ba48f3a99e4e4645d8441c1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 16 May 2008 19:48:06 +0000 Subject: [PATCH] small fix to the guard-caching --- src/common/kernel/move.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/kernel/move.c b/src/common/kernel/move.c index e746df3be..fbfc2c103 100644 --- a/src/common/kernel/move.c +++ b/src/common/kernel/move.c @@ -855,6 +855,7 @@ static boolean is_guardian_u(unit * u2, unit *u, unsigned int mask) { if (u2->faction == u->faction) return false; + if ((getguard(u2) & mask) == 0) return false; if (alliedunit(u2, u->faction, HELP_GUARD)) return false; if (ucontact(u2, u)) return false; if (!cansee(u2->faction, u->region, u, 0)) return false; @@ -863,10 +864,10 @@ is_guardian_u(unit * u2, unit *u, unsigned int mask) } static boolean -is_guardian_r(unit * u2, unsigned int mask) +is_guardian_r(unit * u2) { - if ((getguard(u2) & mask) == 0) return false; if (u2->number == 0) return false; + if ((u2->flags&UFL_GUARD)==0) return false; if (besieged(u2)) return false; if (!armedmen(u2) && !fval(u2->race, RCF_UNARMEDGUARD)) return false; return true; @@ -912,11 +913,12 @@ is_guarded(region * r, unit * u, unsigned int mask) * i is the position of the first free slot in the cache */ for (u2 = (u2?u2->next:r->units); u2; u2=u2->next) { - if (is_guardian_r(u2, mask)) { + if (is_guardian_r(u2)) { /* u2 is a guard, so worth remembering */ if (i