Can only capture buildings of enemies.

This commit is contained in:
johns 2002-06-22 20:46:23 +00:00
parent f5ee034ce8
commit 1de4be3467

View file

@ -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!