From 9f2408473f588fada027ff148a43b13b18588b42 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 15 Jun 2020 09:51:53 +0300 Subject: [PATCH] [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. --- .../worldstate/ProcessorWorldTime.hpp | 22 +++++------ apps/openmw/mwworld/datetimemanager.cpp | 39 ------------------- apps/openmw/mwworld/datetimemanager.hpp | 30 -------------- 3 files changed, 10 insertions(+), 81 deletions(-) diff --git a/apps/openmw/mwmp/processors/worldstate/ProcessorWorldTime.hpp b/apps/openmw/mwmp/processors/worldstate/ProcessorWorldTime.hpp index 8d5a3e521..6537ed5f1 100644 --- a/apps/openmw/mwmp/processors/worldstate/ProcessorWorldTime.hpp +++ b/apps/openmw/mwmp/processors/worldstate/ProcessorWorldTime.hpp @@ -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); } }; } diff --git a/apps/openmw/mwworld/datetimemanager.cpp b/apps/openmw/mwworld/datetimemanager.cpp index 548230a71..0894c974d 100644 --- a/apps/openmw/mwworld/datetimemanager.cpp +++ b/apps/openmw/mwworld/datetimemanager.cpp @@ -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); diff --git a/apps/openmw/mwworld/datetimemanager.hpp b/apps/openmw/mwworld/datetimemanager.hpp index add878c43..b460be746 100644 --- a/apps/openmw/mwworld/datetimemanager.hpp +++ b/apps/openmw/mwworld/datetimemanager.hpp @@ -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;