[Client] Share WeatherManager to the mwmp::Main class

sol2-server-rewrite
Koncord 7 years ago
parent 44dc153ebe
commit 25b7095396

@ -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;
}

@ -5,6 +5,11 @@
#include <boost/program_options.hpp>
#include <components/files/collections.hpp>
namespace MWWorld
{
class WeatherManager;
}
namespace mwmp
{
class GUIController;
@ -23,7 +28,7 @@ namespace mwmp
static bool init(std::vector<std::string> &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;
};
}

@ -210,6 +210,7 @@ namespace MWWorld
mSwimHeightScale = mStore.get<ESM::GameSetting>().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)
{

Loading…
Cancel
Save