--- a/ChangeLog.txt Fri Oct 05 19:25:14 2018 +0200
+++ b/ChangeLog.txt Fri Oct 05 19:37:06 2018 +0200
@@ -68,6 +68,8 @@
* Controllers are detected again
* Fix failure to shutdown game window properly after player got kicked
* No longer allow having schemes with equal names (case-insensitive)
+ * Refuse to load schemes which match the name of a default scheme
+ * No longer save default weapon schemes into file
* Pseudo player names in chat (like “[server]”) are no longer clickable
* Lobby/room: No longer allow opening context menu if no player selected
--- a/QTfrontend/model/gameSchemeModel.cpp Fri Oct 05 19:25:14 2018 +0200
+++ b/QTfrontend/model/gameSchemeModel.cpp Fri Oct 05 19:37:06 2018 +0200
@@ -738,6 +738,11 @@
if (!QDir(cfgdir->absolutePath() + "/Schemes").exists()) {
QDir().mkdir(cfgdir->absolutePath() + "/Schemes");
}
+ QStringList predefSchemesNamesLower;
+ for (int i = 0; i < predefSchemesNames.size(); ++i)
+ {
+ predefSchemesNamesLower.append(predefSchemesNames[i].toLower());
+ }
if (!QDir(directory).exists()) {
QDir().mkdir(directory);
@@ -751,7 +756,7 @@
legacyFileConfig.setArrayIndex(i);
QString schemeName = legacyFileConfig.value(spNames[0]).toString();
- if (!schemeName.isNull() && !predefSchemesNames.contains(schemeName))
+ if (!schemeName.isNull() && !predefSchemesNamesLower.contains(schemeName.toLower()))
{
QList<QVariant> scheme;
QFile file(directory + "/" + schemeName + ".hwg");
@@ -794,6 +799,11 @@
if (schemeName.endsWith(".hwg", Qt::CaseInsensitive)) {
schemeName.chop(4);
}
+ // Don't load scheme if name collides with default scheme
+ if (predefSchemesNamesLower.contains(schemeName.toLower())) {
+ qWarning("Game scheme \"%s\" not loaded from file, name collides with a default scheme!", qPrintable(schemeName));
+ continue;
+ }
// Parse game scheme file
if (file.open(QIODevice::ReadOnly)) {
QTextStream stream(&file);