From 9fc66d5de613a9035c5d0b43890be9173339424d Mon Sep 17 00:00:00 2001 From: Dave Corley Date: Wed, 21 Feb 2024 15:25:13 -0600 Subject: [PATCH 1/3] Fix(idvalidator): Allow any printable character in refIds --- apps/opencs/view/world/idvalidator.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/apps/opencs/view/world/idvalidator.cpp b/apps/opencs/view/world/idvalidator.cpp index 6f790d20cb..b089c1df39 100644 --- a/apps/opencs/view/world/idvalidator.cpp +++ b/apps/opencs/view/world/idvalidator.cpp @@ -4,13 +4,7 @@ bool CSVWorld::IdValidator::isValid(const QChar& c, bool first) const { - if (c.isLetter() || c == '_') - return true; - - if (!first && (c.isDigit() || c.isSpace())) - return true; - - return false; + return c.isPrint() ? true : false; } CSVWorld::IdValidator::IdValidator(bool relaxed, QObject* parent) From 090a389febf317f3480d29ce8c11f9c320bfb827 Mon Sep 17 00:00:00 2001 From: Dave Corley Date: Thu, 22 Feb 2024 02:52:58 -0600 Subject: [PATCH 2/3] Cleanup(idvalidator): Just don't use isValid function and instead directly check if input is a printable char --- apps/opencs/view/world/idvalidator.cpp | 7 +------ apps/opencs/view/world/idvalidator.hpp | 3 --- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/apps/opencs/view/world/idvalidator.cpp b/apps/opencs/view/world/idvalidator.cpp index b089c1df39..078bd6bce5 100644 --- a/apps/opencs/view/world/idvalidator.cpp +++ b/apps/opencs/view/world/idvalidator.cpp @@ -2,11 +2,6 @@ #include -bool CSVWorld::IdValidator::isValid(const QChar& c, bool first) const -{ - return c.isPrint() ? true : false; -} - CSVWorld::IdValidator::IdValidator(bool relaxed, QObject* parent) : QValidator(parent) , mRelaxed(relaxed) @@ -86,7 +81,7 @@ QValidator::State CSVWorld::IdValidator::validate(QString& input, int& pos) cons { prevScope = false; - if (!isValid(*iter, first)) + if (!iter->isPrint()) return QValidator::Invalid; } } diff --git a/apps/opencs/view/world/idvalidator.hpp b/apps/opencs/view/world/idvalidator.hpp index e831542961..6b98d35672 100644 --- a/apps/opencs/view/world/idvalidator.hpp +++ b/apps/opencs/view/world/idvalidator.hpp @@ -13,9 +13,6 @@ namespace CSVWorld std::string mNamespace; mutable std::string mError; - private: - bool isValid(const QChar& c, bool first) const; - public: IdValidator(bool relaxed = false, QObject* parent = nullptr); ///< \param relaxed Relaxed rules for IDs that also functino as user visible text From 9c5f269e52b48a7dd1b6cba479289b3071942fb5 Mon Sep 17 00:00:00 2001 From: Dave Corley Date: Thu, 22 Feb 2024 02:54:04 -0600 Subject: [PATCH 3/3] Add changelog entry for #7721 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96e6de5648..3815905684 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -133,6 +133,7 @@ Bug #7679: Scene luminance value flashes when toggling shaders Bug #7685: Corky sometimes doesn't follow Llovyn Andus Bug #7712: Casting doesn't support spells and enchantments with no effects + Bug #7721: CS: Special Chars Not Allowed in IDs Bug #7723: Assaulting vampires and werewolves shouldn't be a crime Bug #7724: Guards don't help vs werewolves Bug #7733: Launcher shows incorrect data paths when there's two plugins with the same name