From 0d8bfbfa9b8c373208ec3b61832e8e5b6d64481b Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 23 Aug 2014 18:22:09 +0200 Subject: [PATCH 1/6] getpcrank did not read the explicit reference in some cases (Fixed #1767) --- apps/openmw/mwscript/statsextensions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 49a483f27..84d9c4d7e 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -637,6 +637,8 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { + MWWorld::Ptr ptr = R()(runtime); + std::string factionID = ""; if(arg0 >0) { @@ -645,8 +647,6 @@ namespace MWScript } else { - MWWorld::Ptr ptr = R()(runtime); - if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty()) { factionID = ""; From 7de49a66e28fa2dfe8b9a860034a4a441037bbfe Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 23 Aug 2014 18:45:06 +0200 Subject: [PATCH 2/6] fix for PCJoinFaction and for getPcRank without explicit reference --- apps/openmw/mwscript/statsextensions.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 84d9c4d7e..63e05502a 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -528,11 +528,12 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { + MWWorld::Ptr actor = R()(runtime, false); + std::string factionID = ""; if(arg0==0) { - MWWorld::Ptr actor = R()(runtime); factionID = getDialogueActorFaction(actor); } else @@ -637,7 +638,7 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { - MWWorld::Ptr ptr = R()(runtime); + MWWorld::Ptr ptr = R()(runtime, false); std::string factionID = ""; if(arg0 >0) From 80d39780ae4a5022d87f18fa790096184d405e6f Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 23 Aug 2014 18:50:53 +0200 Subject: [PATCH 3/6] same fix for a couple of additional instructions --- apps/openmw/mwscript/statsextensions.cpp | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 63e05502a..c012cb12e 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -563,11 +563,12 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { + MWWorld::Ptr actor = R()(runtime, false); + std::string factionID = ""; if(arg0==0) { - MWWorld::Ptr actor = R()(runtime); factionID = getDialogueActorFaction(actor); } else @@ -603,11 +604,12 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { + MWWorld::Ptr actor = R()(runtime, false); + std::string factionID = ""; if(arg0==0) { - MWWorld::Ptr actor = R()(runtime); factionID = getDialogueActorFaction(actor); } else @@ -751,6 +753,8 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { + MWWorld::Ptr ptr = R()(runtime, false); + std::string factionId; if (arg0==1) @@ -760,8 +764,6 @@ namespace MWScript } else { - MWWorld::Ptr ptr = R()(runtime); - if (!ptr.getClass().getNpcStats (ptr).getFactionRanks().empty()) factionId = ptr.getClass().getNpcStats (ptr).getFactionRanks().begin()->first; } @@ -784,6 +786,8 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { + MWWorld::Ptr ptr = R()(runtime, false); + Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); @@ -796,8 +800,6 @@ namespace MWScript } else { - MWWorld::Ptr ptr = R()(runtime); - if (!ptr.getClass().getNpcStats (ptr).getFactionRanks().empty()) factionId = ptr.getClass().getNpcStats (ptr).getFactionRanks().begin()->first; } @@ -819,6 +821,8 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { + MWWorld::Ptr ptr = R()(runtime, false); + Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); @@ -831,8 +835,6 @@ namespace MWScript } else { - MWWorld::Ptr ptr = R()(runtime); - if (!ptr.getClass().getNpcStats (ptr).getFactionRanks().empty()) factionId = ptr.getClass().getNpcStats (ptr).getFactionRanks().begin()->first; } @@ -914,6 +916,8 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { + MWWorld::Ptr ptr = R()(runtime, false); + std::string factionID = ""; if(arg0 >0 ) { @@ -922,8 +926,6 @@ namespace MWScript } else { - MWWorld::Ptr ptr = R()(runtime); - if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty()) { factionID = ""; @@ -953,6 +955,8 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { + MWWorld::Ptr ptr = R()(runtime, false); + std::string factionID = ""; if(arg0 >0 ) { @@ -961,7 +965,6 @@ namespace MWScript } else { - MWWorld::Ptr ptr = R()(runtime); if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty()) { factionID = ""; @@ -986,6 +989,8 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { + MWWorld::Ptr ptr = R()(runtime, false); + std::string factionID = ""; if(arg0 >0 ) { @@ -994,7 +999,6 @@ namespace MWScript } else { - MWWorld::Ptr ptr = R()(runtime); if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty()) { factionID = ""; From 736ab76f6895f1795073856cb0bd6c156099b262 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 24 Aug 2014 10:17:15 +0200 Subject: [PATCH 4/6] limit argument error workaround to PositionCell instruction (Fixes #1732) --- components/compiler/lineparser.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/compiler/lineparser.cpp b/components/compiler/lineparser.cpp index 0a3629912..3ae6f4b29 100644 --- a/components/compiler/lineparser.cpp +++ b/components/compiler/lineparser.cpp @@ -1,6 +1,8 @@ #include "lineparser.hpp" +#include + #include #include "scanner.hpp" @@ -297,7 +299,12 @@ namespace Compiler try { - ErrorDowngrade errorDowngrade (getErrorHandler()); + // workaround for broken positioncell instructions. + /// \todo add option to disable this + std::auto_ptr errorDowngrade (0); + if (Misc::StringUtils::lowerCase (loc.mLiteral)=="positioncell") + errorDowngrade.reset (new ErrorDowngrade (getErrorHandler())); + std::vector code; optionals = mExprParser.parseArguments (argumentType, scanner, code); mCode.insert (mCode.begin(), code.begin(), code.end()); From 52f6a2ec7b94beed468088be425ee6e6558ce401 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 24 Aug 2014 11:58:08 +0200 Subject: [PATCH 5/6] remote local variable access was always using variable with index 1 instead of the index specified by the access request (Fixes #1739) --- apps/openmw/mwscript/interpretercontext.cpp | 2 +- components/compiler/locals.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 121b07e34..e401318d6 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -111,7 +111,7 @@ namespace MWScript const std::string& name, char type) const { int index = MWBase::Environment::get().getScriptManager()->getLocals (scriptId). - search (type, name); + searchIndex (type, name); if (index!=-1) return index; diff --git a/components/compiler/locals.hpp b/components/compiler/locals.hpp index cf7899b5c..1b2ae6042 100644 --- a/components/compiler/locals.hpp +++ b/components/compiler/locals.hpp @@ -15,8 +15,6 @@ namespace Compiler std::vector mLongs; std::vector mFloats; - int searchIndex (char type, const std::string& name) const; - std::vector& get (char type); public: @@ -27,9 +25,11 @@ namespace Compiler int getIndex (const std::string& name) const; ///< return index for local variable \a name (-1: does not exist). + bool search (char type, const std::string& name) const; + /// Return index for local variable \a name of type \a type (-1: variable does not /// exit). - bool search (char type, const std::string& name) const; + int searchIndex (char type, const std::string& name) const; const std::vector& get (char type) const; From 174153b2da254662d719dc9614d37b59dadd4316 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 24 Aug 2014 17:46:08 +0200 Subject: [PATCH 6/6] Revert "Fix member variable case problem" This reverts commit f0354ea04c8288971078b273130a490d7f42434e. Fixes #759 (again) Conflicts: components/compiler/lineparser.cpp --- components/compiler/lineparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/compiler/lineparser.cpp b/components/compiler/lineparser.cpp index 3ae6f4b29..2f835924d 100644 --- a/components/compiler/lineparser.cpp +++ b/components/compiler/lineparser.cpp @@ -122,7 +122,7 @@ namespace Compiler if (mState==SetMemberVarState) { - mMemberName = name; + mMemberName = Misc::StringUtils::lowerCase (name); std::pair type = getContext().getMemberType (mMemberName, mName); if (type.first!=' ')