Skip to content

Commit

Permalink
Fix group label ID and game object ID collision.
Browse files Browse the repository at this point in the history
  • Loading branch information
KJeff01 committed May 17, 2019
1 parent 683642d commit b63648f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/qtscriptfuncs.cpp
Expand Up @@ -369,14 +369,19 @@ std::pair<bool, int> seenLabelCheck(QScriptEngine *engine, BASE_OBJECT *seen, BA
bool foundObj = false, foundGroup = false;
for (auto &l : labels)
{
if (l.id == seen->id && l.triggered == 0
&& (l.subscriber == ALL_PLAYERS || l.subscriber == viewer->player))
if (l.triggered != 0 || !(l.subscriber == ALL_PLAYERS || l.subscriber == viewer->player))
{
continue;
}

// Don't let a seen game object ID which matches a group label ID to prematurely
// trigger a group label.
if (l.type != SCRIPT_GROUP && l.id == seen->id)
{
l.triggered = viewer->id; // record who made the discovery
foundObj = true;
}
else if (l.type == SCRIPT_GROUP && l.id == groupId && l.triggered == 0
&& (l.subscriber == ALL_PLAYERS || l.subscriber == viewer->player))
else if (l.type == SCRIPT_GROUP && l.id == groupId)
{
l.triggered = viewer->id; // record who made the discovery
foundGroup = true;
Expand Down

0 comments on commit b63648f

Please sign in to comment.