#include "compilercontext.hpp" #include "../mwworld/esmstore.hpp" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../mwbase/environment.hpp" #include "../mwbase/scriptmanager.hpp" #include "../mwbase/world.hpp" #include "../mwworld/class.hpp" #include "../mwworld/manualref.hpp" #include "../mwworld/ptr.hpp" namespace MWScript { CompilerContext::CompilerContext(Type type) : mType(type) { } bool CompilerContext::canDeclareLocals() const { return mType == Type_Full; } char CompilerContext::getGlobalType(const std::string& name) const { return MWBase::Environment::get().getWorld()->getGlobalVariableType(name); } std::pair CompilerContext::getMemberType(const std::string& name, const ESM::RefId& id) const { ESM::RefId script; bool reference = false; if (const ESM::Script* scriptRecord = MWBase::Environment::get().getESMStore()->get().search(id)) { script = scriptRecord->mId; } else { MWWorld::ManualRef ref(*MWBase::Environment::get().getESMStore(), id); script = ref.getPtr().getClass().getScript(ref.getPtr()); reference = true; } char type = ' '; if (!script.empty()) type = MWBase::Environment::get().getScriptManager()->getLocals(script).getType( Misc::StringUtils::lowerCase(name)); return std::make_pair(type, reference); } bool CompilerContext::isId(const ESM::RefId& name) const { const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore(); return store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name) || store.get().search(name); } }