[Client] Update setting of time via WorldTime packets

The setting of time-related values was previously handled directly in OpenMW's World class. It is now handled in OpenMW's DateTimeManager class instead when the variable names passed to World's setGlobalInt() and setGlobalFloat() are time-related.
pull/593/head
David Cernat 5 years ago
parent e5b1843089
commit 9f2408473f

@ -20,25 +20,23 @@ namespace mwmp
{
MWBase::World *world = MWBase::Environment::get().getWorld();
/*
if (worldstate.time.hour != -1)
world->setHour(worldstate.time.hour);
world->setGlobalFloat("gamehour", worldstate.time.hour);
if (worldstate.time.day != -1)
world->setDay(worldstate.time.day);
world->setGlobalInt("day", worldstate.time.day);
if (worldstate.time.month != -1)
world->setMonth(worldstate.time.month);
world->setGlobalInt("month", worldstate.time.month);
if (worldstate.time.year != -1)
world->setYear(worldstate.time.year);
if (worldstate.time.daysPassed != -1)
world->setDaysPassed(worldstate.time.daysPassed);
world->setGlobalInt("year", worldstate.time.year);
if (worldstate.time.timeScale != -1)
world->setTimeScale(worldstate.time.timeScale);
*/
world->setGlobalFloat("timescale", worldstate.time.timeScale);
if (worldstate.time.daysPassed != -1)
world->setGlobalInt("dayspassed", worldstate.time.daysPassed);
}
};
}

@ -85,45 +85,6 @@ namespace MWWorld
mMonth = month;
}
/*
Start of tes3mp addition
Make it possible to set the year from elsewhere
*/
void DateTimeManager::setYear(int year)
{
mYear = year;
}
/*
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to set the number of days passed from elsewhere
*/
void DateTimeManager::setDaysPassed(int days)
{
mDaysPassed = days;
}
/*
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to set a custom timeScale from elsewhere
*/
void DateTimeManager::setTimeScale(float timeScale)
{
mTimeScale = timeScale;
}
/*
End of tes3mp addition
*/
TimeStamp DateTimeManager::getTimeStamp() const
{
return TimeStamp(mGameHour, mDaysPassed);

@ -26,36 +26,6 @@ namespace MWWorld
void setDay(int day);
void setMonth(int month);
/*
Start of tes3mp addition
Make it possible to set the year from elsewhere
*/
void setYear(int year);
/*
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to set the number of days passed from elsewhere
*/
void setDaysPassed(int daysPassed);
/*
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to set a custom timeScale from elsewhere
*/
void setTimeScale(float timeScale);
/*
End of tes3mp addition
*/
public:
std::string getMonthName(int month) const;
TimeStamp getTimeStamp() const;

Loading…
Cancel
Save