From 778738debb2d59835f8046930a6ac5689fb8f036 Mon Sep 17 00:00:00 2001 From: jsalmon3 <> Date: Sat, 11 Jan 2003 17:21:03 +0000 Subject: [PATCH] Fixed sight of cancelled buildings. Fixed crash for units with no corpses. --- src/unit/unit.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/unit/unit.cpp b/src/unit/unit.cpp index 9dcc45b53..7fe9cde1e 100644 --- a/src/unit/unit.cpp +++ b/src/unit/unit.cpp @@ -487,15 +487,15 @@ global void PlaceUnit(Unit* unit,int x,int y) // // Update fog of war, if unit belongs to player on this computer // - if( unit->Host ) { + if( unit->Host && !unit->Host->Data.Builded.Cancel ) { MapUnmarkSight(unit->Player,unit->Host->X+unit->Host->Type->TileWidth/2 ,unit->Host->Y+unit->Host->Type->TileHeight/2 ,unit->CurrentSightRange); + unit->Host = NULL; } unit->CurrentSightRange=unit->Type->Stats->SightRange; MapMarkSight(unit->Player,x,y,unit->CurrentSightRange); - unit->Host = NULL; #else if( unit->Player==ThisPlayer || (ThisPlayer && IsSharedVision(ThisPlayer,unit)) ) { @@ -3157,7 +3157,11 @@ global void LetUnitDie(Unit* unit) unit->Wait=1; unit->Orders[0].Action=UnitActionDie; #ifdef NEW_FOW - unit->CurrentSightRange=unit->Type->CorpseType->Stats->SightRange; + if( unit->Type->CorpseType ) { + unit->CurrentSightRange=unit->Type->CorpseType->Stats->SightRange; + } else { + unit->CurrentSightRange=1; + } MapMarkSight(unit->Player,unit->X,unit->Y,unit->CurrentSightRange); #endif }