Fixed bug: Repair command, didn't repair units.

This commit is contained in:
johns 2001-03-25 22:02:43 +00:00
parent 3ca283c0d0
commit cb3d6232ef

View file

@ -424,16 +424,23 @@ global void CommandRepair(Unit* unit,int x,int y,Unit* dest,int flush)
// Should be handled in action, but is not possible!
// Unit::Refs is used as timeout counter.
//
if( dest->Destroyed ) {
order->X=dest->X+dest->Type->TileWidth/2;
order->Y=dest->Y+dest->Type->TileHeight/2;
order->Goal=NoUnitP;
order->RangeX=order->RangeY=0;
if( dest ) {
if( dest->Destroyed ) {
order->X=dest->X+dest->Type->TileWidth/2;
order->Y=dest->Y+dest->Type->TileHeight/2;
order->Goal=NoUnitP;
order->RangeX=order->RangeY=0;
} else {
order->X=order->Y=-1;
order->Goal=dest;
RefsDebugCheck( !dest->Refs );
dest->Refs++;
order->RangeX=order->RangeY=REPAIR_RANGE;
}
} else {
order->X=order->Y=-1;
order->Goal=dest;
RefsDebugCheck( !dest->Refs );
dest->Refs++;
order->X=x;
order->Y=y;
order->Goal=NoUnitP;
order->RangeX=order->RangeY=REPAIR_RANGE;
}
order->Type=NULL;