From 9f1b85d562e9f09fefaaf29c95427164575655ed Mon Sep 17 00:00:00 2001 From: Itms Date: Tue, 14 Jul 2015 17:08:02 +0000 Subject: [PATCH] Remove a useless global terrain update when modifying environment settings in Atlas. Also make sure that the settings are updated in the game view in a non-hacky way. This was SVN commit r16855. --- source/simulation2/components/CCmpWaterManager.cpp | 9 ++++++--- .../atlas/GameInterface/Handlers/EnvironmentHandlers.cpp | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/simulation2/components/CCmpWaterManager.cpp b/source/simulation2/components/CCmpWaterManager.cpp index 41c59b23ce..5b25d0f3a7 100644 --- a/source/simulation2/components/CCmpWaterManager.cpp +++ b/source/simulation2/components/CCmpWaterManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Wildfire Games. +/* Copyright (C) 2015 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -102,13 +102,16 @@ public: g_Renderer.GetWaterManager()->RecomputeWindStrength(); g_Renderer.GetWaterManager()->CreateWaveMeshes(); } - + // Tell the terrain it'll need to recompute its cached render data GetSimContext().GetTerrain().MakeDirty(RENDERDATA_UPDATE_VERTICES); } virtual void SetWaterLevel(entity_pos_t h) { + if (m_WaterHeight == h) + return; + m_WaterHeight = h; // Tell the terrain it'll need to recompute its cached render data @@ -116,7 +119,7 @@ public: if (CRenderer::IsInitialised()) g_Renderer.GetWaterManager()->m_WaterHeight = h.ToFloat(); - + CMessageWaterChanged msg; GetSimContext().GetComponentManager().BroadcastMessage(msg); } diff --git a/source/tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp index e34f26aa22..c6ad41563c 100644 --- a/source/tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp +++ b/source/tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp @@ -142,6 +142,8 @@ void SetSettings(const sEnvironmentSettings& s) COLOR(s.unitcolor, g_LightEnv.m_UnitsAmbientColor); COLOR(s.fogcolor, g_LightEnv.m_FogColor); #undef COLOR + + cmpWaterManager->RecomputeWaterData(); } BEGIN_COMMAND(SetEnvironmentSettings)