From 1de4be3467e29d3c3b6e69d9a1986ed1ec209558 Mon Sep 17 00:00:00 2001
From: johns <>
Date: Sat, 22 Jun 2002 20:46:23 +0000
Subject: [PATCH] Can only capture buildings of enemies.

---
 src/unit/unit.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/unit/unit.cpp b/src/unit/unit.cpp
index f52e9c361..73103dad2 100644
--- a/src/unit/unit.cpp
+++ b/src/unit/unit.cpp
@@ -3338,8 +3338,9 @@ global void HitUnit(Unit* attacker,Unit* target,int damage)
     // Only worker types can capture.
     // Still possible to destroy building if not careful (too many attackers)
     if( EnableBuildingCapture && attacker
-	    && type->Building && target->HP<=damage*3 &&
-	    (attacker->Type==UnitTypeOrcWorker
+	    && type->Building && target->HP<=damage*3
+	    && IsEnemy(attacker->Player,target)
+	    && (attacker->Type==UnitTypeOrcWorker
 		|| attacker->Type==UnitTypeHumanWorker) ) {
 	ChangeUnitOwner(target, target->Player, attacker->Player);
 	CommandStopUnit(attacker);	// Attacker shouldn't continue attack!