1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 03:53:54 +00:00

removed some redundant code

This commit is contained in:
Marc Zinnschlag 2013-11-28 09:13:54 +01:00
parent 71436b1160
commit b0eb5938bf
2 changed files with 19 additions and 27 deletions

View file

@ -143,45 +143,23 @@ namespace MWScript
void InterpreterContext::setGlobalShort (const std::string& name, int value)
{
if (name=="gamehour")
MWBase::Environment::get().getWorld()->setHour (value);
else if (name=="day")
MWBase::Environment::get().getWorld()->setDay (value);
else if (name=="month")
MWBase::Environment::get().getWorld()->setMonth (value);
else
MWBase::Environment::get().getWorld()->setGlobalInt (name, value);
MWBase::Environment::get().getWorld()->setGlobalInt (name, value);
}
void InterpreterContext::setGlobalLong (const std::string& name, int value)
{
if (name=="gamehour")
MWBase::Environment::get().getWorld()->setHour (value);
else if (name=="day")
MWBase::Environment::get().getWorld()->setDay (value);
else if (name=="month")
MWBase::Environment::get().getWorld()->setMonth (value);
else
MWBase::Environment::get().getWorld()->setGlobalInt (name, value);
MWBase::Environment::get().getWorld()->setGlobalInt (name, value);
}
void InterpreterContext::setGlobalFloat (const std::string& name, float value)
{
if (name=="gamehour")
MWBase::Environment::get().getWorld()->setHour (value);
else if (name=="day")
MWBase::Environment::get().getWorld()->setDay (value);
else if (name=="month")
MWBase::Environment::get().getWorld()->setMonth (value);
else
MWBase::Environment::get().getWorld()->setGlobalFloat (name, value);
MWBase::Environment::get().getWorld()->setGlobalFloat (name, value);
}
std::vector<std::string> InterpreterContext::getGlobals () const
{
MWBase::World *world = MWBase::Environment::get().getWorld();
return world->getGlobals();
}
char InterpreterContext::getGlobalType (const std::string& name) const

View file

@ -424,12 +424,26 @@ namespace MWWorld
void World::setGlobalInt (const std::string& name, int value)
{
mGlobalVariables->setInt (name, value);
if (name=="gamehour")
setHour (value);
else if (name=="day")
setDay (value);
else if (name=="month")
setMonth (value);
else
mGlobalVariables->setInt (name, value);
}
void World::setGlobalFloat (const std::string& name, float value)
{
mGlobalVariables->setFloat (name, value);
if (name=="gamehour")
setHour (value);
else if (name=="day")
setDay (value);
else if (name=="month")
setMonth (value);
else
mGlobalVariables->setFloat (name, value);
}
int World::getGlobalInt (const std::string& name) const