From 4b62e6a428c5c62c47845f86643812712831238d Mon Sep 17 00:00:00 2001
From: jsalmon3 <>
Date: Fri, 25 Apr 2003 04:26:23 +0000
Subject: [PATCH] Fixed bug counting unit near itself

---
 src/game/trigger.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/game/trigger.cpp b/src/game/trigger.cpp
index fb94e934b..e7d8b810c 100644
--- a/src/game/trigger.cpp
+++ b/src/game/trigger.cpp
@@ -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;
 	}