Fixed bug : Crashes with flame shield attacking buildings.

This commit is contained in:
johns 2002-03-31 14:07:58 +00:00
parent d0a9890df6
commit e93273afae

View file

@ -3078,9 +3078,10 @@ global void HitUnit(Unit* attacker,Unit* target,int damage)
// david: capture enemy buildings
// Only worker types can capture.
// Still possible to destroy building if not careful (too many attackers)
if( EnableBuildingCapture && type->Building && target->HP<=damage*3 &&
if( EnableBuildingCapture && attack
&& type->Building && target->HP<=damage*3 &&
(attacker->Type==UnitTypeOrcWorker
|| attacker->Type==UnitTypeHumanWorker) ) {
|| attacker->Type==UnitTypeHumanWorker) ) {
ChangeUnitOwner(target, target->Player, attacker->Player);
CommandStopUnit(attacker); // Attacker shouldn't continue attack!
}