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.
This commit is contained in:
Nicolas Auvray 2015-07-14 17:08:02 +00:00
parent b0386d7fab
commit 9f1b85d562
2 changed files with 8 additions and 3 deletions

View File

@ -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);
}

View File

@ -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)