Skip to content

Commit

Permalink
Check for redundant templates in JS function setDesign().
Browse files Browse the repository at this point in the history
  • Loading branch information
KJeff01 committed Jun 14, 2019
1 parent 44eb5e4 commit 370cfd6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions data/base/script/rules.js
Expand Up @@ -156,6 +156,7 @@ function reticuleDesignCheck()
{
setReticuleButton(4, _("Design - construct HQ first"), "", "");
setMiniMap(false);
// Will enable templates that are researched whenever the reticule buttons update.
setDesign(false);
}
}
Expand Down
1 change: 0 additions & 1 deletion data/mp/multiplay/skirmish/rules.js
Expand Up @@ -108,7 +108,6 @@ function reticuleDesignCheck()
{
setReticuleButton(4, _("Design - construct HQ first"), "", "");
setMiniMap(false);
setDesign(false);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/qtscriptfuncs.cpp
Expand Up @@ -3251,13 +3251,13 @@ static QScriptValue js_setDesign(QScriptContext *context, QScriptEngine *engine)
// FIXME: This dual data structure for templates is just plain insane.
for (auto &keyvaluepair : droidTemplates[selectedPlayer])
{
bool researched = researchedTemplate(keyvaluepair.second, selectedPlayer);
bool researched = researchedTemplate(keyvaluepair.second, selectedPlayer, true);
keyvaluepair.second->enabled = (researched || allowDesign);
}
for (auto &localTemplate : localTemplates)
{
psCurr = &localTemplate;
bool researched = researchedTemplate(psCurr, selectedPlayer);
bool researched = researchedTemplate(psCurr, selectedPlayer, true);
psCurr->enabled = (researched || allowDesign);
}
return QScriptValue();
Expand Down

0 comments on commit 370cfd6

Please sign in to comment.