From 05727f2bcd901eef5ca9d49d43a9579469df3669 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Thu, 25 Apr 2019 17:20:47 +0300 Subject: [PATCH 1/3] Ignore string arguments for AITravel, GetDynamic, LowerRank, RaiseRank --- components/compiler/extensions0.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/compiler/extensions0.cpp b/components/compiler/extensions0.cpp index 516495da6f..a269876b50 100644 --- a/components/compiler/extensions0.cpp +++ b/components/compiler/extensions0.cpp @@ -33,7 +33,7 @@ namespace Compiler { extensions.registerInstruction ("aiactivate", "c/l", opcodeAIActivate, opcodeAIActivateExplicit); - extensions.registerInstruction ("aitravel", "fff/l", opcodeAiTravel, + extensions.registerInstruction ("aitravel", "fff/lx", opcodeAiTravel, opcodeAiTravelExplicit); extensions.registerInstruction ("aiescort", "cffff/l", opcodeAiEscort, opcodeAiEscortExplicit); @@ -422,7 +422,7 @@ namespace Compiler for (int i=0; i Date: Thu, 25 Apr 2019 17:53:41 +0300 Subject: [PATCH 2/3] Ignore extra numerical arguments for ForceGreeting, Position(Cell), PlaceItem(Cell) --- components/compiler/extensions0.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/compiler/extensions0.cpp b/components/compiler/extensions0.cpp index a269876b50..4674e93439 100644 --- a/components/compiler/extensions0.cpp +++ b/components/compiler/extensions0.cpp @@ -180,7 +180,7 @@ namespace Compiler extensions.registerFunction ("getjournalindex", 'l', "c", opcodeGetJournalIndex); extensions.registerInstruction ("addtopic", "S" , opcodeAddTopic); extensions.registerInstruction ("choice", "j/SlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSl", opcodeChoice); - extensions.registerInstruction("forcegreeting","",opcodeForceGreeting, + extensions.registerInstruction("forcegreeting","X",opcodeForceGreeting, opcodeForceGreetingExplicit); extensions.registerInstruction("goodbye", "", opcodeGoodbye); extensions.registerInstruction("setreputation", "l", opcodeSetReputation, @@ -536,10 +536,10 @@ namespace Compiler extensions.registerInstruction("setpos","cf",opcodeSetPos,opcodeSetPosExplicit); extensions.registerFunction("getpos",'f',"c",opcodeGetPos,opcodeGetPosExplicit); extensions.registerFunction("getstartingpos",'f',"c",opcodeGetStartingPos,opcodeGetStartingPosExplicit); - extensions.registerInstruction("position","ffff",opcodePosition,opcodePositionExplicit); - extensions.registerInstruction("positioncell","ffffc",opcodePositionCell,opcodePositionCellExplicit); - extensions.registerInstruction("placeitemcell","ccffff",opcodePlaceItemCell); - extensions.registerInstruction("placeitem","cffff",opcodePlaceItem); + extensions.registerInstruction("position","ffffX",opcodePosition,opcodePositionExplicit); + extensions.registerInstruction("positioncell","ffffcX",opcodePositionCell,opcodePositionCellExplicit); + extensions.registerInstruction("placeitemcell","ccffffX",opcodePlaceItemCell); + extensions.registerInstruction("placeitem","cffffX",opcodePlaceItem); extensions.registerInstruction("placeatpc","clflX",opcodePlaceAtPc); extensions.registerInstruction("placeatme","clflX",opcodePlaceAtMe,opcodePlaceAtMeExplicit); extensions.registerInstruction("modscale","f",opcodeModScale,opcodeModScaleExplicit); From 3c18079c149e44581979d7b01305988163b4307e Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Thu, 2 May 2019 20:49:40 +0300 Subject: [PATCH 3/3] Handle invalid instruction axis more gracefully --- .../mwscript/transformationextensions.cpp | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/apps/openmw/mwscript/transformationextensions.cpp b/apps/openmw/mwscript/transformationextensions.cpp index 93645d5fba..33a71a94af 100644 --- a/apps/openmw/mwscript/transformationextensions.cpp +++ b/apps/openmw/mwscript/transformationextensions.cpp @@ -108,8 +108,6 @@ namespace MWScript MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,angle,az); else if (axis == "z") MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,angle); - else - throw std::runtime_error ("invalid rotation axis: " + axis); } }; @@ -137,8 +135,6 @@ namespace MWScript { runtime.push(osg::RadiansToDegrees(ptr.getCellRef().getPosition().rot[2])); } - else - throw std::runtime_error ("invalid rotation axis: " + axis); } }; @@ -195,8 +191,6 @@ namespace MWScript { runtime.push(ptr.getRefData().getPosition().pos[2]); } - else - throw std::runtime_error ("invalid axis: " + axis); } }; @@ -248,7 +242,9 @@ namespace MWScript updated = MWBase::Environment::get().getWorld()->moveObject(ptr,ax,ay,pos,true); } else - throw std::runtime_error ("invalid axis: " + axis); + { + return; + } dynamic_cast(runtime.getContext()).updatePtr(ptr,updated); } @@ -278,8 +274,6 @@ namespace MWScript { runtime.push(ptr.getCellRef().getPosition().pos[2]); } - else - throw std::runtime_error ("invalid axis: " + axis); } }; @@ -570,8 +564,6 @@ namespace MWScript MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay+rotation,az); else if (axis == "z") MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,az+rotation); - else - throw std::runtime_error ("invalid rotation axis: " + axis); } }; @@ -604,7 +596,7 @@ namespace MWScript else if (axis == "z") rot = osg::Quat(rotation, -osg::Z_AXIS); else - throw std::runtime_error ("invalid rotation axis: " + axis); + return; osg::Quat attitude = ptr.getRefData().getBaseNode()->getAttitude(); MWBase::Environment::get().getWorld()->rotateWorldObject(ptr, attitude * rot); @@ -667,7 +659,7 @@ namespace MWScript posChange=osg::Vec3f(0, 0, movement); } else - throw std::runtime_error ("invalid movement axis: " + axis); + return; // is it correct that disabled objects can't be Move-d? if (!ptr.getRefData().getBaseNode()) @@ -711,7 +703,7 @@ namespace MWScript else if (axis == "z") diff.z() += movement; else - throw std::runtime_error ("invalid movement axis: " + axis); + return; // We should move actors, standing on moving object, too. // This approach can be used to create elevators.