From 52b717f8481fdf08f72a007892a93eb58d17ac2f Mon Sep 17 00:00:00 2001 From: c0d3d3v Date: Sun, 5 Jun 2022 15:21:00 +0200 Subject: [PATCH] Fix deleting envelopes not updating sounds --- src/game/editor/editor.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 0997653ed..5e3213ac9 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -6190,6 +6190,21 @@ void CEditorMap::DeleteEnvelope(int Index) if(pLayerTiles->m_ColorEnv > Index) pLayerTiles->m_ColorEnv--; } + else if(pLayer->m_Type == LAYERTYPE_SOUNDS) + { + CLayerSounds *pLayerSounds = static_cast(pLayer); + for(auto &Source : pLayerSounds->m_lSources) + { + if(Source.m_PosEnv == Index) + Source.m_PosEnv = -1; + else if(Source.m_PosEnv > Index) + Source.m_PosEnv--; + if(Source.m_SoundEnv == Index) + Source.m_SoundEnv = -1; + else if(Source.m_SoundEnv > Index) + Source.m_SoundEnv--; + } + } m_lEnvelopes.erase(m_lEnvelopes.begin() + Index); }