mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-29 04:20:29 +00:00
Allow messageboxes arguments to have newline characters (bug #3836)
This commit is contained in:
parent
dc9aedca7d
commit
a560a9e00d
@ -23,6 +23,7 @@
|
|||||||
Bug #3591: Angled hit distance too low
|
Bug #3591: Angled hit distance too low
|
||||||
Bug #3629: DB assassin attack never triggers creature spawning
|
Bug #3629: DB assassin attack never triggers creature spawning
|
||||||
Bug #3788: GetPCInJail and GetPCTraveling do not work as in vanilla
|
Bug #3788: GetPCInJail and GetPCTraveling do not work as in vanilla
|
||||||
|
Bug #3836: Script fails to compile when command argument contains "\n"
|
||||||
Bug #3876: Landscape texture painting is misaligned
|
Bug #3876: Landscape texture painting is misaligned
|
||||||
Bug #3897: Have Goodbye give all choices the effects of Goodbye
|
Bug #3897: Have Goodbye give all choices the effects of Goodbye
|
||||||
Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters
|
Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters
|
||||||
|
@ -306,10 +306,22 @@ namespace Compiler
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
std::string lowerCase = Misc::StringUtils::lowerCase(name);
|
std::string lowerCase = Misc::StringUtils::lowerCase(name);
|
||||||
|
bool isKeyword = false;
|
||||||
for (; sKeywords[i]; ++i)
|
for (; sKeywords[i]; ++i)
|
||||||
if (lowerCase==sKeywords[i])
|
if (lowerCase==sKeywords[i])
|
||||||
|
{
|
||||||
|
isKeyword = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Russian localization and some mods use a quirk - add newline character directly
|
||||||
|
// to compiled bytecode via HEX-editor to implement multiline messageboxes.
|
||||||
|
// Of course, original editor will not compile such script.
|
||||||
|
// Allow messageboxes to bybass the "incomplete string or name" error.
|
||||||
|
if (lowerCase == "messagebox")
|
||||||
|
enableIgnoreNewlines();
|
||||||
|
else if (isKeyword)
|
||||||
|
mIgnoreNewline = false;
|
||||||
|
|
||||||
if (sKeywords[i])
|
if (sKeywords[i])
|
||||||
{
|
{
|
||||||
@ -357,9 +369,14 @@ namespace Compiler
|
|||||||
// }
|
// }
|
||||||
else if (c=='\n')
|
else if (c=='\n')
|
||||||
{
|
{
|
||||||
error = true;
|
if (mIgnoreNewline)
|
||||||
mErrorHandler.error ("incomplete string or name", mLoc);
|
mErrorHandler.warning ("string contains newline character, make sure that it is intended", mLoc);
|
||||||
break;
|
else
|
||||||
|
{
|
||||||
|
error = true;
|
||||||
|
mErrorHandler.error ("incomplete string or name", mLoc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!(c=='"' && name.empty()))
|
else if (!(c=='"' && name.empty()))
|
||||||
@ -578,7 +595,7 @@ namespace Compiler
|
|||||||
const Extensions *extensions)
|
const Extensions *extensions)
|
||||||
: mErrorHandler (errorHandler), mStream (inputStream), mExtensions (extensions),
|
: mErrorHandler (errorHandler), mStream (inputStream), mExtensions (extensions),
|
||||||
mPutback (Putback_None), mPutbackCode(0), mPutbackInteger(0), mPutbackFloat(0),
|
mPutback (Putback_None), mPutbackCode(0), mPutbackInteger(0), mPutbackFloat(0),
|
||||||
mStrictKeywords (false), mTolerantNames (false)
|
mStrictKeywords (false), mTolerantNames (false), mIgnoreNewline(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,6 +648,11 @@ namespace Compiler
|
|||||||
mExtensions->listKeywords (keywords);
|
mExtensions->listKeywords (keywords);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Scanner::enableIgnoreNewlines()
|
||||||
|
{
|
||||||
|
mIgnoreNewline = true;
|
||||||
|
}
|
||||||
|
|
||||||
void Scanner::enableStrictKeywords()
|
void Scanner::enableStrictKeywords()
|
||||||
{
|
{
|
||||||
mStrictKeywords = true;
|
mStrictKeywords = true;
|
||||||
|
@ -39,6 +39,7 @@ namespace Compiler
|
|||||||
TokenLoc mPutbackLoc;
|
TokenLoc mPutbackLoc;
|
||||||
bool mStrictKeywords;
|
bool mStrictKeywords;
|
||||||
bool mTolerantNames;
|
bool mTolerantNames;
|
||||||
|
bool mIgnoreNewline;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -126,6 +127,11 @@ namespace Compiler
|
|||||||
void listKeywords (std::vector<std::string>& keywords);
|
void listKeywords (std::vector<std::string>& keywords);
|
||||||
///< Append all known keywords to \a keywords.
|
///< Append all known keywords to \a keywords.
|
||||||
|
|
||||||
|
/// Treat newline character as a part of script command.
|
||||||
|
///
|
||||||
|
/// \attention This mode lasts only until the next keyword is reached.
|
||||||
|
void enableIgnoreNewlines();
|
||||||
|
|
||||||
/// Do not accept keywords in quotation marks anymore.
|
/// Do not accept keywords in quotation marks anymore.
|
||||||
///
|
///
|
||||||
/// \attention This mode lasts only until the next newline is reached.
|
/// \attention This mode lasts only until the next newline is reached.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user