2013-04-10 20:49:22 +00:00
|
|
|
|
|
|
|
#include "scriptcontext.hpp"
|
|
|
|
|
2013-09-19 10:30:42 +00:00
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
#include <components/misc/stringops.hpp>
|
|
|
|
|
|
|
|
#include "data.hpp"
|
|
|
|
|
|
|
|
CSMWorld::ScriptContext::ScriptContext (const Data& data) : mData (data), mIdsUpdated (false) {}
|
|
|
|
|
2013-04-10 20:49:22 +00:00
|
|
|
bool CSMWorld::ScriptContext::canDeclareLocals() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
char CSMWorld::ScriptContext::getGlobalType (const std::string& name) const
|
|
|
|
{
|
|
|
|
return ' ';
|
|
|
|
}
|
|
|
|
|
|
|
|
char CSMWorld::ScriptContext::getMemberType (const std::string& name, const std::string& id) const
|
|
|
|
{
|
|
|
|
return ' ';
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSMWorld::ScriptContext::isId (const std::string& name) const
|
|
|
|
{
|
2013-09-19 10:30:42 +00:00
|
|
|
if (!mIdsUpdated)
|
|
|
|
{
|
|
|
|
mIds = mData.getIds();
|
|
|
|
|
|
|
|
std::for_each (mIds.begin(), mIds.end(), &Misc::StringUtils::lowerCase);
|
|
|
|
|
|
|
|
mIdsUpdated = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::binary_search (mIds.begin(), mIds.end(), Misc::StringUtils::lowerCase (name));
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSMWorld::ScriptContext::invalidateIds()
|
|
|
|
{
|
|
|
|
mIdsUpdated = false;
|
2013-04-10 20:49:22 +00:00
|
|
|
}
|