From 870043f8b6f63e32bacdb3d3caeca1d4792ff8b1 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Sun, 9 May 2021 14:58:21 -0400 Subject: [PATCH] scripting_engine::loadLabels: Fixes for uninitialized values --- src/qtscript.cpp | 10 +++++----- src/qtscript.h | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/qtscript.cpp b/src/qtscript.cpp index a87ad498eaf..70eba05a5dc 100644 --- a/src/qtscript.cpp +++ b/src/qtscript.cpp @@ -1956,9 +1956,9 @@ bool scripting_engine::loadLabels(const char *filename) p.type = SCRIPT_POSITION; p.player = ALL_PLAYERS; p.id = -1; - p.triggered = -1; // always deactivated - labels[label] = p; p.triggered = ini.value("triggered", -1).toInt(); // deactivated by default + p.subscriber = ALL_PLAYERS; + labels[label] = p; } else if (list[i].startsWith("area")) { @@ -1982,16 +1982,15 @@ bool scripting_engine::loadLabels(const char *filename) p.subscriber = ini.value("subscriber", ALL_PLAYERS).toInt(); p.id = -1; labels[label] = p; - p.triggered = ini.value("triggered", -1).toInt(); // deactivated by default } else if (list[i].startsWith("object")) { p.id = ini.value("id").toInt(); p.type = ini.value("type").toInt(); p.player = ini.value("player").toInt(); - labels[label] = p; p.triggered = ini.value("triggered", -1).toInt(); // deactivated by default p.subscriber = ini.value("subscriber", ALL_PLAYERS).toInt(); + labels[label] = p; } else if (list[i].startsWith("group")) { @@ -2007,8 +2006,9 @@ bool scripting_engine::loadLabels(const char *filename) id, p.player, list[i].toUtf8().c_str()); p.idlist.push_back(id); } - labels[label] = p; p.triggered = ini.value("triggered", -1).toInt(); // deactivated by default + p.subscriber = ini.value("subscriber", ALL_PLAYERS).toInt(); + labels[label] = p; } else { diff --git a/src/qtscript.h b/src/qtscript.h index fbbf0bec6ef..a9eb205434c 100644 --- a/src/qtscript.h +++ b/src/qtscript.h @@ -164,7 +164,8 @@ void jsDebugMessageUpdate(); struct LABEL { - Vector2i p1, p2; // world coordinates + Vector2i p1 = Vector2i(0, 0); // world coordinates + Vector2i p2 = Vector2i(0, 0); // world coordinates int id; int type; int player;