mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Merge branch 'areyouthere' into 'master'
Add record presence early-outs for various script instructions (feature #7625) Closes #7625 See merge request OpenMW/openmw!3501
This commit is contained in:
commit
1ec4681e40
@ -114,6 +114,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
|
||||
|
@ -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<uint16_t>(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<uint16_t>(count);
|
||||
|
||||
|
@ -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<ESM::Dialogue>().search(topic))
|
||||
{
|
||||
runtime.getContext().report(
|
||||
"Failed to add topic '" + topic.getRefIdString() + "': topic record not found");
|
||||
return;
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getDialogueManager()->addTopic(topic);
|
||||
}
|
||||
};
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <components/esm3/loadmisc.hpp>
|
||||
#include <components/esm3/loadprob.hpp>
|
||||
#include <components/esm3/loadrepa.hpp>
|
||||
#include <components/esm3/loadscpt.hpp>
|
||||
#include <components/esm3/loadstat.hpp>
|
||||
#include <components/esm3/loadweap.hpp>
|
||||
|
||||
@ -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<ESM::Script>().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<ESM::Script>().search(name))
|
||||
{
|
||||
runtime.getContext().report(
|
||||
"Failed to stop global script '" + name.getRefIdString() + "': script record not found");
|
||||
return;
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().removeScript(name);
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user