dagoth fix

openmw-33
Marc Zinnschlag 10 years ago
parent 69bbbefc09
commit 8afdf0f46b

@ -16,18 +16,23 @@ namespace MWScript
{
struct ExplicitRef
{
MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true) const
MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true,
bool activeOnly = false) const
{
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
runtime.pop();
return MWBase::Environment::get().getWorld()->getPtr (id, false);
if (required)
return MWBase::Environment::get().getWorld()->getPtr (id, activeOnly);
else
return MWBase::Environment::get().getWorld()->searchPtr (id, activeOnly);
}
};
struct ImplicitRef
{
MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true) const
MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true,
bool activeOnly = false) const
{
MWScript::InterpreterContext& context
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());

@ -217,6 +217,8 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime)
{
int peek = runtime[0].mInteger;
MWWorld::Ptr ptr = R()(runtime);
Interpreter::Type_Float diff = runtime[0].mFloat;
@ -224,7 +226,17 @@ namespace MWScript
// workaround broken endgame scripts that kill dagoth ur
if (Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "dagoth_ur_1"))
return;
{
runtime.push (peek);
if (R()(runtime, false, true).isEmpty())
{
std::cerr
<< "Compensating for broken script in Morrowind.esm by "
<< "ignoring remote access to dagoth_ur_1" << std::endl;
return;
}
}
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr);

Loading…
Cancel
Save