From 8d63ddfdefc7b8a9a7d108fbd31cd5a6d8f0be4e Mon Sep 17 00:00:00 2001 From: Maikel de Vries Date: Sat, 30 Jan 2016 12:28:15 +0100 Subject: [PATCH] fix additional preview overlay after combining with other structure This caused an overlay warning in the previewer object when constructing an elevetor and combining it with another elevator and detaching it again. --- .../Constructor.ocd/ConstructionPreviewer.ocd/Script.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/planet/Objects.ocd/Libraries.ocd/Constructor.ocd/ConstructionPreviewer.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/Constructor.ocd/ConstructionPreviewer.ocd/Script.c index fd2da3be8..37422d466 100644 --- a/planet/Objects.ocd/Libraries.ocd/Constructor.ocd/ConstructionPreviewer.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/Constructor.ocd/ConstructionPreviewer.ocd/Script.c @@ -90,18 +90,18 @@ public func AdjustPreview(bool below_surface, bool look_up, bool no_call) { if (!stick_to) { - SetClrModulation(RGBa(50,255,50, 100), GFX_PreviewerPictureOverlay); + if (extra_overlay) SetClrModulation(RGBa(50,255,50, 100), GFX_PreviewerPictureOverlay); SetClrModulation(RGBa(50,255,50, 100), GFX_StructureOverlay); } else { - SetClrModulation(RGBa(255,255,50, 200), GFX_PreviewerPictureOverlay); + if (extra_overlay) SetClrModulation(RGBa(255,255,50, 200), GFX_PreviewerPictureOverlay); SetClrModulation(RGBa(255,255,50, 200), GFX_StructureOverlay); } } else { - SetClrModulation(RGBa(255,50,50, 100), GFX_PreviewerPictureOverlay); + if (extra_overlay) SetClrModulation(RGBa(255,50,50, 100), GFX_PreviewerPictureOverlay); SetClrModulation(RGBa(255,50,50, 100), GFX_StructureOverlay); } } @@ -169,6 +169,8 @@ func Reposition(int x, int y) dir = 0; SetObjDrawTransform(1000, 0, dimension_x/2 * 1000 * dir, 0, 1000, 0, GFX_CombineIconOverlay); } + // Update the extra overlay possibly added to the preview. + extra_overlay = structure->~ConstructionPreview(this, GFX_PreviewerPictureOverlay, direction); // Update alternative preview in the definition to be placed. structure->~AlternativeConstructionPreview(this, direction, stick_to); SetPosition(x, y);