diff --git a/apps/openmw/mwmp/Main.cpp b/apps/openmw/mwmp/Main.cpp index 54cd6daff..e29901c4e 100644 --- a/apps/openmw/mwmp/Main.cpp +++ b/apps/openmw/mwmp/Main.cpp @@ -236,7 +236,7 @@ void Main::updateWorld(float dt) const } } -const Main &Main::get() +Main &Main::get() { return *pMain; } @@ -345,3 +345,13 @@ bool Main::isValidPacketScript(std::string script) return true; */ } + +void Main::setWeatherManager(MWWorld::WeatherManager* manager) +{ + mWeatherManager = manager; +} + +MWWorld::WeatherManager *Main::getWeatherManager() +{ + return mWeatherManager; +} diff --git a/apps/openmw/mwmp/Main.hpp b/apps/openmw/mwmp/Main.hpp index 9e6c13bd6..6295017b0 100644 --- a/apps/openmw/mwmp/Main.hpp +++ b/apps/openmw/mwmp/Main.hpp @@ -5,6 +5,11 @@ #include #include +namespace MWWorld +{ + class WeatherManager; +} + namespace mwmp { class GUIController; @@ -23,7 +28,7 @@ namespace mwmp static bool init(std::vector &content, Files::Collections &collections); static void postInit(); static void destroy(); - static const Main &get(); + static Main &get(); static void frame(float dt); static void pressedKey(int key); @@ -37,6 +42,9 @@ namespace mwmp void updateWorld(float dt) const; + void setWeatherManager(MWWorld::WeatherManager* manager); + MWWorld::WeatherManager* getWeatherManager(); + private: static std::string resourceDir; static std::string addr; @@ -54,6 +62,7 @@ namespace mwmp std::string server; unsigned short port; + MWWorld::WeatherManager* mWeatherManager; }; } diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 7f4c34531..c8de73a38 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -210,6 +210,7 @@ namespace MWWorld mSwimHeightScale = mStore.get().find("fSwimHeightScale")->getFloat(); mWeatherManager = new MWWorld::WeatherManager(*mRendering, mFallback, mStore); + mwmp::Main::get().setWeatherManager(mWeatherManager); mWorldScene = new Scene(*mRendering, mPhysics); } @@ -246,6 +247,7 @@ namespace MWWorld // Note that if reset later, the initial ChangeWeather that the chargen script calls will be lost. delete mWeatherManager; mWeatherManager = new MWWorld::WeatherManager(*mRendering, mFallback, mStore); + mwmp::Main::get().setWeatherManager(mWeatherManager); if (!bypass) {