--- a/ChangeLog.txt Thu Apr 25 23:59:50 2019 +0300
+++ b/ChangeLog.txt Thu Apr 25 23:01:30 2019 +0200
@@ -93,6 +93,7 @@
+ More intelligent automatic mission selection in campaign screen
* Fix force-locked schemes getting unlocked when changing map types
* Fix possible to select background-only or hidden themes indirectly by changing map type
+ * Disallow slash, backslash and colon characters in team and scheme names
Sounds and voicepacks:
+ sndYoohoo has been split to sndYoohoo and sndKiss
--- a/QTfrontend/hwconsts.cpp.in Thu Apr 25 23:59:50 2019 +0300
+++ b/QTfrontend/hwconsts.cpp.in Thu Apr 25 23:01:30 2019 +0200
@@ -34,6 +34,8 @@
QString * cRevisionString = new QString("${HEDGEWARS_REVISION}");
QString * cHashString = new QString("${HEDGEWARS_HASH}");
+// For disallowing some characters that would screw up file name
+QString * cSafeFileNameRegExp = new QString("[^:/\\\\]*");
QDir * bindir = new QDir();
QDir * cfgdir = new QDir();
--- a/QTfrontend/hwconsts.h Thu Apr 25 23:59:50 2019 +0300
+++ b/QTfrontend/hwconsts.h Thu Apr 25 23:01:30 2019 +0200
@@ -28,6 +28,7 @@
extern QString * cRevisionString;
extern QString * cHashString;
extern QString * cDataDir;
+extern QString * cSafeFileNameRegExp;
extern QDir * bindir;
extern QDir * cfgdir;
--- a/QTfrontend/ui/page/pageeditteam.cpp Thu Apr 25 23:59:50 2019 +0300
+++ b/QTfrontend/ui/page/pageeditteam.cpp Thu Apr 25 23:01:30 2019 +0200
@@ -28,9 +28,12 @@
#include <QMessageBox>
#include <QStandardItemModel>
#include <QDebug>
+#include <QRegExp>
+#include <QRegExpValidator>
#include "SquareLabel.h"
#include "HWApplication.h"
#include "keybinder.h"
+#include "hwconsts.h"
#include "physfs.h"
#include "DataManager.h"
@@ -129,6 +132,9 @@
TeamNameEdit->setMaxLength(64);
TeamNameEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
TeamNameEdit->setStyleSheet("QLineEdit { padding: 6px; }");
+ QRegExp rx(*cSafeFileNameRegExp);
+ QRegExpValidator * val = new QRegExpValidator(rx, TeamNameEdit);
+ TeamNameEdit->setValidator(val);
GBTLayout->addWidget(TeamNameEdit, 0, 1, 1, 2);
vbox2->addWidget(GBoxTeam);
--- a/QTfrontend/ui/page/pagescheme.cpp Thu Apr 25 23:59:50 2019 +0300
+++ b/QTfrontend/ui/page/pagescheme.cpp Thu Apr 25 23:01:30 2019 +0200
@@ -26,7 +26,10 @@
#include <QMessageBox>
#include <QDataWidgetMapper>
#include <QSpinBox>
+#include <QRegExp>
+#include <QRegExpValidator>
+#include "hwconsts.h"
#include "gameSchemeModel.h"
#include "pagescheme.h"
#include "FreqSpinBox.h"
@@ -517,6 +520,9 @@
L_name->setText(QLabel::tr("Scheme Name:"));
LE_name = new QLineEdit(this);
+ QRegExp rx(*cSafeFileNameRegExp);
+ QRegExpValidator * val = new QRegExpValidator(rx, LE_name);
+ LE_name->setValidator(val);
LE_name->setWhatsThis(tr("Name of this scheme"));
gl->addWidget(LE_name,15,1,1,5);
--- a/QTfrontend/ui/widget/selectWeapon.cpp Thu Apr 25 23:59:50 2019 +0300
+++ b/QTfrontend/ui/widget/selectWeapon.cpp Thu Apr 25 23:01:30 2019 +0200
@@ -31,6 +31,9 @@
#include <QSettings>
#include <QMessageBox>
#include <QTabWidget>
+#include <QRegExp>
+#include <QRegExpValidator>
+
#include <math.h>
QImage getAmmoImage(int num)
@@ -205,6 +208,9 @@
//pLayout->setRowStretch(5, 100);
m_name = new QLineEdit(this);
+ QRegExp rx(*cSafeFileNameRegExp);
+ QRegExpValidator* val = new QRegExpValidator(rx, m_name);
+ m_name->setValidator(val);
pageLayout->addWidget(m_name, i, 0, 1, 5);
}
--- a/share/hedgewars/Data/Names/README.md Thu Apr 25 23:59:50 2019 +0300
+++ b/share/hedgewars/Data/Names/README.md Thu Apr 25 23:01:30 2019 +0200
@@ -42,7 +42,9 @@
* Each hog of this team gets a random hat of this list. Repeat a hat name to
jack up its probability.
-Each team is again separated by a separator line.
+Each team is again separated by a separator line. The team name must not
+contain characters that would be forbidden in a file name (such as “/”,
+“\” or “:”).
At the end of the final team, this line must be written (without the spaces):