From 15396331986b30c9fdd9425fae0896cf1ac08d50 Mon Sep 17 00:00:00 2001 From: clwe Date: Wed, 1 Jul 2020 16:09:34 +0200 Subject: [PATCH] PD: reset global arrays on script reload to fix wrong lights display --- src/LibPDEngine.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/LibPDEngine.cpp b/src/LibPDEngine.cpp index 7d15fc9..fe4199d 100644 --- a/src/LibPDEngine.cpp +++ b/src/LibPDEngine.cpp @@ -208,9 +208,8 @@ void LibPDEngine::receiveLights(const char *s) { // parse switch lights list bool utility_is_valid = true; - int utility_idx = -1; try { - utility_idx = _utility_map.at(atoms[1]); // map::at throws an out-of-range + _utility_map.at(atoms[1]); // map::at throws an out-of-range } catch (const std::out_of_range& oor) { utility_is_valid = false; @@ -221,7 +220,7 @@ void LibPDEngine::receiveLights(const char *s) { if(utility_is_valid && atoms.size()>=3){ g_utility[0] = atoms[1]; // display g_utility[1] = {""}; - for(int i=0; i