diff --git a/CHANGELOG.md b/CHANGELOG.md index d4ac1067da..2ea1c33513 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -109,6 +109,7 @@ Feature #7546: Start the game on Fredas Feature #7568: Uninterruptable scripted music Feature #7618: Show the player character's health in the save details + Feature #7625: Add some missing console error outputs Feature #7634: Support NiParticleBomb Task #5896: Do not use deprecated MyGUI properties Task #7113: Move from std::atoi to std::from_char diff --git a/apps/openmw/mwscript/containerextensions.cpp b/apps/openmw/mwscript/containerextensions.cpp index edee3963e7..4a0d302cd8 100644 --- a/apps/openmw/mwscript/containerextensions.cpp +++ b/apps/openmw/mwscript/containerextensions.cpp @@ -31,6 +31,7 @@ #include "../mwmechanics/actorutil.hpp" #include "../mwmechanics/levelledlist.hpp" +#include "interpretercontext.hpp" #include "ref.hpp" namespace @@ -94,6 +95,12 @@ namespace MWScript Interpreter::Type_Integer count = runtime[0].mInteger; runtime.pop(); + if (!MWBase::Environment::get().getESMStore()->find(item)) + { + runtime.getContext().report("Failed to add item '" + item.getRefIdString() + "': unknown ID"); + return; + } + if (count < 0) count = static_cast(count); @@ -210,6 +217,12 @@ namespace MWScript Interpreter::Type_Integer count = runtime[0].mInteger; runtime.pop(); + if (!MWBase::Environment::get().getESMStore()->find(item)) + { + runtime.getContext().report("Failed to remove item '" + item.getRefIdString() + "': unknown ID"); + return; + } + if (count < 0) count = static_cast(count); diff --git a/apps/openmw/mwscript/dialogueextensions.cpp b/apps/openmw/mwscript/dialogueextensions.cpp index 1f0a9a37cf..6511fbdb01 100644 --- a/apps/openmw/mwscript/dialogueextensions.cpp +++ b/apps/openmw/mwscript/dialogueextensions.cpp @@ -16,6 +16,7 @@ #include "../mwmechanics/npcstats.hpp" #include "../mwworld/class.hpp" +#include "../mwworld/esmstore.hpp" #include "ref.hpp" @@ -89,6 +90,13 @@ namespace MWScript ESM::RefId topic = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger)); runtime.pop(); + if (!MWBase::Environment::get().getESMStore()->get().search(topic)) + { + runtime.getContext().report( + "Failed to add topic '" + topic.getRefIdString() + "': topic record not found"); + return; + } + MWBase::Environment::get().getDialogueManager()->addTopic(topic); } }; diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index 43da00afe3..687b512106 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -184,6 +185,14 @@ namespace MWScript MWWorld::Ptr target = R()(runtime, false); ESM::RefId name = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger)); runtime.pop(); + + if (!MWBase::Environment::get().getESMStore()->get().search(name)) + { + runtime.getContext().report( + "Failed to start global script '" + name.getRefIdString() + "': script record not found"); + return; + } + MWBase::Environment::get().getScriptManager()->getGlobalScripts().addScript(name, target); } }; @@ -206,6 +215,14 @@ namespace MWScript { const ESM::RefId& name = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger)); runtime.pop(); + + if (!MWBase::Environment::get().getESMStore()->get().search(name)) + { + runtime.getContext().report( + "Failed to stop global script '" + name.getRefIdString() + "': script record not found"); + return; + } + MWBase::Environment::get().getScriptManager()->getGlobalScripts().removeScript(name); } };