Fix duplicate event script label completions

This commit is contained in:
BigBahss 2021-04-16 08:22:05 -04:00
parent 61ffcc3259
commit f72d4bda50
3 changed files with 6 additions and 4 deletions

View file

@ -180,7 +180,7 @@ public:
QString getScriptDefaultString(bool usePoryScript, QString mapName) const;
QString getMapScriptsFilePath(const QString &mapName) const;
QStringList getEventScriptsFilePaths() const;
QCompleter *getEventScriptLabelCompleter(const QStringList &additionalCompletions) const;
QCompleter *getEventScriptLabelCompleter(QStringList additionalCompletions) const;
bool loadMapBorder(Map *map);

View file

@ -427,8 +427,8 @@ QStringList Map::eventScriptLabels(const QString &event_group_type) const {
scriptLabels << event->get("script_label");
}
scriptLabels.removeAll("");
scriptLabels.removeDuplicates();
scriptLabels.removeAll(QString());
if (scriptLabels.contains("0x0"))
scriptLabels.move(scriptLabels.indexOf("0x0"), scriptLabels.count() - 1);
if (scriptLabels.contains("NULL"))

View file

@ -2386,8 +2386,10 @@ QStringList Project::getEventScriptsFilePaths() const {
return filePaths;
}
QCompleter *Project::getEventScriptLabelCompleter(const QStringList &additionalCompletions) const {
eventScriptLabelModel->setStringList(eventScriptLabels + additionalCompletions);
QCompleter *Project::getEventScriptLabelCompleter(QStringList additionalCompletions) const {
additionalCompletions += eventScriptLabels;
additionalCompletions.removeDuplicates();
eventScriptLabelModel->setStringList(additionalCompletions);
return eventScriptLabelCompleter;
}