From 3472a6f180e81ab510026b4b96760adf4d145181 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 23 Feb 2013 14:40:56 +0100 Subject: [PATCH 1/5] workaround for infinite recursion during local variable access --- apps/openmw/mwscript/scriptmanagerimp.cpp | 42 +++++++++++++++-------- apps/openmw/mwscript/scriptmanagerimp.hpp | 1 + 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/apps/openmw/mwscript/scriptmanagerimp.cpp b/apps/openmw/mwscript/scriptmanagerimp.cpp index 1f338edbd..e8489e3cd 100644 --- a/apps/openmw/mwscript/scriptmanagerimp.cpp +++ b/apps/openmw/mwscript/scriptmanagerimp.cpp @@ -140,25 +140,37 @@ namespace MWScript Compiler::Locals& ScriptManager::getLocals (const std::string& name) { - ScriptCollection::iterator iter = mScripts.find (name); - - if (iter==mScripts.end()) { - if (!compile (name)) - { - /// \todo Handle case of cyclic member variable access. Currently this could look up - /// the whole application in an endless recursion. + ScriptCollection::iterator iter = mScripts.find (name); - // failed -> ignore script from now on. - std::vector empty; - mScripts.insert (std::make_pair (name, std::make_pair (empty, Compiler::Locals()))); - throw std::runtime_error ("failed to compile script " + name); - } - - iter = mScripts.find (name); + if (iter!=mScripts.end()) + return iter->second.second; } - return iter->second.second; + { + std::map::iterator iter = mOtherLocals.find (name); + + if (iter!=mOtherLocals.end()) + return iter->second; + } + + Compiler::Locals locals; + + if (const ESM::Script *script = mStore.get().find (name)) + { + int index = 0; + + for (int i=0; imData.mNumShorts; ++i) + locals.declare ('s', script->mVarNames[index++]); + + for (int i=0; imData.mNumLongs; ++i) + locals.declare ('l', script->mVarNames[index++]); + + for (int i=0; imData.mNumFloats; ++i) + locals.declare ('f', script->mVarNames[index++]); + } + + throw std::logic_error ("script " + name + " does not exist"); } GlobalScripts& ScriptManager::getGlobalScripts() diff --git a/apps/openmw/mwscript/scriptmanagerimp.hpp b/apps/openmw/mwscript/scriptmanagerimp.hpp index c4a016eb7..1a856e0c5 100644 --- a/apps/openmw/mwscript/scriptmanagerimp.hpp +++ b/apps/openmw/mwscript/scriptmanagerimp.hpp @@ -47,6 +47,7 @@ namespace MWScript ScriptCollection mScripts; GlobalScripts mGlobalScripts; + std::map mOtherLocals; public: From a95431c387258d0f3862a9e8a5345336602a4cb2 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 23 Feb 2013 20:20:40 +0100 Subject: [PATCH 2/5] fix --- apps/openmw/mwscript/scriptmanagerimp.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/openmw/mwscript/scriptmanagerimp.cpp b/apps/openmw/mwscript/scriptmanagerimp.cpp index e8489e3cd..fed5877c4 100644 --- a/apps/openmw/mwscript/scriptmanagerimp.cpp +++ b/apps/openmw/mwscript/scriptmanagerimp.cpp @@ -168,6 +168,11 @@ namespace MWScript for (int i=0; imData.mNumFloats; ++i) locals.declare ('f', script->mVarNames[index++]); + + std::map::iterator iter = + mOtherLocals.insert (std::make_pair (name, locals)).first; + + return iter->second; } throw std::logic_error ("script " + name + " does not exist"); From a5ff8181b737b91f096b1182f03066ac14ef0e06 Mon Sep 17 00:00:00 2001 From: lazydev Date: Sun, 24 Feb 2013 03:35:43 +0400 Subject: [PATCH 3/5] fix for https://bugs.openmw.org/issues/569 --- apps/openmw/mwworld/store.hpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index cb18873cc..3eec05234 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -19,7 +19,7 @@ namespace MWWorld virtual int getSize() const = 0; virtual void load(ESM::ESMReader &esm, const std::string &id) = 0; - + virtual bool eraseStatic(const std::string &id) {return false;} }; @@ -110,7 +110,7 @@ namespace MWWorld item.mId = Misc::StringUtils::lowerCase(id); typename std::map::const_iterator it = mStatic.find(item.mId); - + if (it != mStatic.end() && Misc::StringUtils::ciEqual(it->second.mId, id)) { return &(it->second); } @@ -188,14 +188,14 @@ namespace MWWorld item.mId = Misc::StringUtils::lowerCase(id); typename std::map::iterator it = mStatic.find(item.mId); - + if (it != mStatic.end() && Misc::StringUtils::ciEqual(it->second.mId, id)) { mStatic.erase(it); } return true; } - + bool erase(const std::string &id) { std::string key = Misc::StringUtils::lowerCase(id); typename Dynamic::iterator it = mDynamic.find(key); @@ -220,9 +220,15 @@ namespace MWWorld template <> inline void Store::load(ESM::ESMReader &esm, const std::string &id) { std::string idLower = Misc::StringUtils::lowerCase(id); - mStatic[idLower] = ESM::Dialogue(); - mStatic[idLower].mId = id; // don't smash case here, as this line is printed... I think - mStatic[idLower].load(esm); + + std::map::iterator it = mStatic.find(idLower); + if (it == mStatic.end()) { + it = mStatic.insert( std::make_pair( idLower, ESM::Dialogue() ) ).first; + it->second.mId = id; // don't smash case here, as this line is printed... I think + } + + //I am not sure is it need to load the dialog from a plugin if it was already loaded from prevois plugins + it->second.load(esm); } template <> @@ -409,7 +415,7 @@ namespace MWWorld DynamicInt mDynamicInt; DynamicExt mDynamicExt; - + const ESM::Cell *search(const ESM::Cell &cell) const { if (cell.isExterior()) { return search(cell.getGridX(), cell.getGridY()); @@ -481,7 +487,7 @@ namespace MWWorld newCell->mData.mY = y; mExt[std::make_pair(x, y)] = *newCell; delete newCell; - + return &mExt[std::make_pair(x, y)]; } @@ -528,7 +534,7 @@ namespace MWWorld // There some nasty three-way cyclic header dependency involved, which I could only fix by moving // this method. void load(ESM::ESMReader &esm, const std::string &id); - + iterator intBegin() const { return iterator(mSharedInt.begin()); } From 62c5568ed9138eb679f0427a2ea655af872303eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20S=C3=B6derberg?= Date: Sun, 24 Feb 2013 16:57:07 +0100 Subject: [PATCH 4/5] Fix for the loadingbar to resemble vanilla Morrowind. --- files/mygui/openmw_loading_screen.layout | 4 ++-- files/mygui/openmw_progress.skin.xml | 13 +++++++++++++ files/mygui/smallbars.png | Bin 246 -> 3205 bytes 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/files/mygui/openmw_loading_screen.layout b/files/mygui/openmw_loading_screen.layout index 6862702ca..4b6861151 100644 --- a/files/mygui/openmw_loading_screen.layout +++ b/files/mygui/openmw_loading_screen.layout @@ -6,12 +6,12 @@ - + - + diff --git a/files/mygui/openmw_progress.skin.xml b/files/mygui/openmw_progress.skin.xml index c4b94e28e..4666be221 100644 --- a/files/mygui/openmw_progress.skin.xml +++ b/files/mygui/openmw_progress.skin.xml @@ -17,6 +17,11 @@ + + + + + @@ -51,4 +56,12 @@ + + + + + + + + diff --git a/files/mygui/smallbars.png b/files/mygui/smallbars.png index a9ed572ef6dd53092f3e35dd1fc871a60686e91d..f938412c259c540d8e085a339fa0d94c4294a361 100644 GIT binary patch literal 3205 zcmYjTc|6o>7k`GyzGatm$(rnIc4q8r7#UHv7$u?HY>_2fx+Gbr5tV&O)MzYaCo)3T zv1Ch#Zk9%vnRndoeRDpa=X-wNv;Lm*{Bx4dTAQ#k9b*Cju$q|~+EF!>dW0Ehs90ZR z%}7;@0j5qj0AS`iI1rHgh#vqZo6B(c*|R?WLH;*<`~!r|;Beu9>;B%CuX+IxGJ&y2 zA?%lVb%@hjFpI>fhZg>JJPg8iu;eK2Gzn=DMh^2tk%Dm^+m@q7Mo_`-{6yN6l&E_= zwlXYtna1cBM4qI?K25yavo{<5)OVzj__>e#YE*ZrViQx_Pv6YIl4+`Js~W{p3OjN1 zQ*2jz=j?)F_jo_I*hxb=E^%!9MCz)kY@=OGY<*~tlq0OyAy zJdpe}Ak5{JXb60?Kt=z#yG8)10Jyy^+BLwKEKo3W^fm?6b)Xr~!CV6vSb&0UV%#YJ z4F_)BqM{+-P7dHU-f-0Ze!7ZdNt!yToEmMMn1)fbGlOg(y`!Vt2`Ri8-)U|&cN+Ix zeYw`q908?h74}b??*Yh9fz$6cgo3IktG+>S_#DU>r=O!!?Qx9v%b zG*weYySoTs2UDR9o$E9j2`y2 z`dkHVL(;Zq|BGNKXS7i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&x2M`?)6%mba5mg|}wqAOD zjaaLXgil6Y2Ck=DGTNi*9(IC(f}_*`XaN-7J;m0Vu(X6{noP6(|JxT0PCY1eTX63H O0000 Date: Sun, 24 Feb 2013 16:57:40 +0100 Subject: [PATCH 5/5] Prettier repeated borders. --- files/mygui/openmw_hud_box.skin.xml | 88 +++++++++++++++-------------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/files/mygui/openmw_hud_box.skin.xml b/files/mygui/openmw_hud_box.skin.xml index ce231e5bb..464b6343a 100644 --- a/files/mygui/openmw_hud_box.skin.xml +++ b/files/mygui/openmw_hud_box.skin.xml @@ -2,76 +2,78 @@ - - - + + + + - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + - - - + + + + - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - -