Skip to content

Commit

Permalink
scripting_engine::loadLabels: Fixes for uninitialized values
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed May 12, 2021
1 parent e49a9f9 commit 870043f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/qtscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
{
Expand All @@ -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"))
{
Expand All @@ -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
{
Expand Down
3 changes: 2 additions & 1 deletion src/qtscript.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 870043f

Please sign in to comment.