mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 18:32:36 +00:00
Parse special characters that have been put back as names too
This commit is contained in:
parent
76ad680549
commit
54429cd23b
@ -326,6 +326,8 @@ End)mwscript";
|
||||
Addtopic -spells...
|
||||
Addtopic -magicka...
|
||||
|
||||
player->PositionCell, -97274, -94273, 8064, -12,-12
|
||||
|
||||
End)mwscript";
|
||||
|
||||
const std::string sIssue4061 = R"mwscript(Begin 01_Rz_neuvazhay-koryto2
|
||||
@ -763,7 +765,33 @@ End)mwscript";
|
||||
mTopics.erase(mTopics.begin());
|
||||
}
|
||||
};
|
||||
class PositionCell : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
void execute(Interpreter::Runtime& runtime)
|
||||
{
|
||||
std::string_view target = runtime.getStringLiteral(runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
Interpreter::Type_Float x = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
Interpreter::Type_Float y = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
Interpreter::Type_Float z = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
Interpreter::Type_Float zRot = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
std::string_view cellID = runtime.getStringLiteral(runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
EXPECT_EQ(target, "player");
|
||||
EXPECT_EQ(x, -97274);
|
||||
EXPECT_EQ(y, -94273);
|
||||
EXPECT_EQ(z, 8064);
|
||||
EXPECT_EQ(zRot, -12);
|
||||
EXPECT_EQ(cellID, "-12");
|
||||
}
|
||||
};
|
||||
installOpcode<AddTopic>(Compiler::Dialogue::opcodeAddTopic, topics);
|
||||
installOpcode<PositionCell>(Compiler::Transformation::opcodePositionCellExplicit);
|
||||
TestInterpreterContext context;
|
||||
run(*script, context);
|
||||
EXPECT_TRUE(topics.empty());
|
||||
|
@ -63,9 +63,22 @@ namespace Compiler
|
||||
switch (mPutback)
|
||||
{
|
||||
case Putback_Special:
|
||||
|
||||
{
|
||||
mPutback = Putback_None;
|
||||
// Replicate behaviour from scanSpecial so putting something back doesn't change the way it's handled
|
||||
if (mExpectName && (mPutbackCode == S_member || mPutbackCode == S_minus))
|
||||
{
|
||||
mExpectName = false;
|
||||
bool cont = false;
|
||||
bool tolerant = mTolerantNames;
|
||||
mTolerantNames = true;
|
||||
MultiChar c{ mPutbackCode == S_member ? '.' : '-' };
|
||||
scanName(c, parser, cont);
|
||||
mTolerantNames = tolerant;
|
||||
return cont;
|
||||
}
|
||||
return parser.parseSpecial(mPutbackCode, mPutbackLoc, *this);
|
||||
}
|
||||
|
||||
case Putback_Integer:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user