From 9489076c513e9a28ea238cb4e5d56ccff635ac32 Mon Sep 17 00:00:00 2001 From: historic_bruno Date: Thu, 24 Nov 2011 01:16:30 +0000 Subject: [PATCH] Fixes logic error in 8d977e4818. This was SVN commit r10585. --- .../data/mods/public/simulation/components/GuiInterface.js | 6 +++--- binaries/data/mods/public/simulation/helpers/Commands.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/binaries/data/mods/public/simulation/components/GuiInterface.js b/binaries/data/mods/public/simulation/components/GuiInterface.js index b45d7e9f7c..81a328e646 100644 --- a/binaries/data/mods/public/simulation/components/GuiInterface.js +++ b/binaries/data/mods/public/simulation/components/GuiInterface.js @@ -512,10 +512,10 @@ GuiInterface.prototype.SetBuildingPlacementPreview = function(player, cmd) // tell GetLosVisibility to force RetainInFog because preview entities set this to false, // which would show them as hidden instead of fogged var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); - var hidden = (cmpRangeManager && cmpRangeManager.GetLosVisibility(ent, player, true) == "hidden"); + var visible = (cmpRangeManager && cmpRangeManager.GetLosVisibility(ent, player, true) != "hidden"); var validPlacement = false; - if (!hidden) + if (visible) { // Check whether it's obstructed by other entities or invalid terrain var cmpBuildRestrictions = Engine.QueryInterface(ent, IID_BuildRestrictions); if (!cmpBuildRestrictions) @@ -524,7 +524,7 @@ GuiInterface.prototype.SetBuildingPlacementPreview = function(player, cmd) validPlacement = (cmpBuildRestrictions && cmpBuildRestrictions.CheckPlacement(player)); } - var ok = (!hidden && validPlacement); + var ok = (visible && validPlacement); // Set it to a red shade if this is an invalid location var cmpVisual = Engine.QueryInterface(ent, IID_Visual); diff --git a/binaries/data/mods/public/simulation/helpers/Commands.js b/binaries/data/mods/public/simulation/helpers/Commands.js index d86a1c1798..75de58e168 100644 --- a/binaries/data/mods/public/simulation/helpers/Commands.js +++ b/binaries/data/mods/public/simulation/helpers/Commands.js @@ -220,8 +220,8 @@ function ProcessCommand(player, cmd) // tell GetLosVisibility to force RetainInFog because preview entities set this to false, // which would show them as hidden instead of fogged var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); - var hidden = (cmpRangeManager.GetLosVisibility(ent, player, true) == "hidden"); - if (hidden) + var visible = (cmpRangeManager && cmpRangeManager.GetLosVisibility(ent, player, true) != "hidden"); + if (!visible) { if (g_DebugCommands) {