From 22f7d4eee2d95c32856cc3c352bc709235ba1ee5 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sun, 20 Jun 2021 18:02:11 +0200 Subject: [PATCH] Strip quotes when treating keywords as strings --- CHANGELOG.md | 1 + components/compiler/stringparser.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 285933ad4f..1229785394 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Bug #3737: Scripts from The Underground 2 .esp do not play (all patched versions) Bug #3846: Strings starting with "-" fail to compile if not enclosed in quotes Bug #5483: AutoCalc flag is not used to calculate spells cost + Bug #6066: addtopic "return" does not work from within script. No errors thrown Bug #6101: Disarming trapped unlocked owned objects isn't considered a crime 0.47.0 diff --git a/components/compiler/stringparser.cpp b/components/compiler/stringparser.cpp index 1bacf79410..8b20377e1f 100644 --- a/components/compiler/stringparser.cpp +++ b/components/compiler/stringparser.cpp @@ -65,7 +65,11 @@ namespace Compiler keyword==Scanner::K_messagebox || keyword==Scanner::K_set || keyword==Scanner::K_to || keyword==Scanner::K_getsquareroot) { - return parseName (loc.mLiteral, loc, scanner); + // pretend this is not a keyword + std::string name = loc.mLiteral; + if (name.size()>=2 && name[0]=='"' && name[name.size()-1]=='"') + name = name.substr (1, name.size()-2); + return parseName (name, loc, scanner); } return Parser::parseKeyword (keyword, loc, scanner);