From 850cc41653e3514b2558833b3efdd5ddb43578bc Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Thu, 28 Jan 2010 03:50:25 +0000 Subject: [PATCH] Fix bug #1483 - unbuilt structures and walls shouldn't confer visibility. git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9536 4a71c877-e1ca-e34f-864e-861f7616d084 --- src/structure.c | 2 ++ src/visibility.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/structure.c b/src/structure.c index 7d5e75507..30437578f 100644 --- a/src/structure.c +++ b/src/structure.c @@ -5935,6 +5935,8 @@ void buildingComplete(STRUCTURE *psBuilding) psBuilding->currentBuildPts = (SWORD)psBuilding->pStructureType->buildPoints; psBuilding->status = SS_BUILT; + visTilesUpdate((BASE_OBJECT *)psBuilding, rayTerrainCallback); + switch (psBuilding->pStructureType->type) { case REF_POWER_GEN: diff --git a/src/visibility.c b/src/visibility.c index c2e748c7e..aa412e05d 100644 --- a/src/visibility.c +++ b/src/visibility.c @@ -304,6 +304,17 @@ void visTilesUpdate(BASE_OBJECT *psObj, RAY_CALLBACK callback) // Remove previous map visibility provided by object visRemoveVisibility(psObj); + if (psObj->type == OBJ_STRUCTURE) + { + STRUCTURE * psStruct = (STRUCTURE *)psObj; + if (psStruct->status != SS_BUILT || + psStruct->pStructureType->type == REF_WALL || psStruct->pStructureType->type == REF_WALLCORNER) + { + // unbuilt structures and walls do not confer visibility. + return; + } + } + // Do the whole circle in 80 steps for (ray = 0; ray < NUM_RAYS; ray += NUM_RAYS / 80) {