Fixed bug counting unit near itself

This commit is contained in:
jsalmon3 2003-04-25 04:26:23 +00:00
parent f72a9b2fe0
commit 4b62e6a428

View file

@ -415,6 +415,12 @@ local SCM CclIfNearUnit(SCM player,SCM operation,SCM quantity,SCM unit,
}
}
}
// Check if we counted the unit near itself
if( unittype==ANY_UNIT
|| (unittype==ALL_FOODUNITS && ut2->Building)
|| (unittype==ALL_BUILDINGS && ut2->Building) ) {
--s;
}
if( compare(s,q) ) {
return SCM_BOOL_T;
}
@ -505,6 +511,12 @@ local SCM CclIfRescuedNearUnit(SCM player,SCM operation,SCM quantity,SCM unit,
}
}
}
// Check if we counted the unit near itself
if( unittype==ANY_UNIT
|| (unittype==ALL_FOODUNITS && ut2->Building)
|| (unittype==ALL_BUILDINGS && ut2->Building) ) {
--s;
}
if( compare(s,q) ) {
return SCM_BOOL_T;
}