1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 03:39:14 +00:00
OpenMW/apps/openmw/mwscript/ref.cpp
Alexander "Ace" Olofsson fce404acc5 Remove some including of mwbase/world.hpp
Since ref.hpp is rather well used in OpenMW-CS this should help compile times there
2015-02-09 17:45:48 +01:00

30 lines
855 B
C++

#include "ref.hpp"
#include <components/interpreter/runtime.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "interpretercontext.hpp"
MWWorld::Ptr MWScript::ExplicitRef::operator() (Interpreter::Runtime& runtime, bool required,
bool activeOnly) const
{
std::string id = runtime.getStringLiteral(runtime[0].mInteger);
runtime.pop();
if (required)
return MWBase::Environment::get().getWorld()->getPtr(id, activeOnly);
else
return MWBase::Environment::get().getWorld()->searchPtr(id, activeOnly);
}
MWWorld::Ptr MWScript::ImplicitRef::operator() (Interpreter::Runtime& runtime, bool required,
bool activeOnly) const
{
MWScript::InterpreterContext& context
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
return context.getReference(required);
}