From 002b41ba51a19f59c4b15293be22d4ca95a625ea Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 14 Sep 2014 08:33:41 +0200 Subject: [PATCH] Make changeWeather work when the player isn't in a cell yet (workaround for modTESTchargen_v2_5) --- apps/openmw/mwworld/weather.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 675a3e86e6..613fd712fd 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -702,9 +702,13 @@ void WeatherManager::changeWeather(const std::string& region, const unsigned int mRegionOverrides[Misc::StringUtils::lowerCase(region)] = weather; - std::string playerRegion = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->getCell()->mRegion; - if (Misc::StringUtils::ciEqual(region, playerRegion)) - setWeather(weather); + MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); + if (player.isInCell()) + { + std::string playerRegion = player.getCell()->getCell()->mRegion; + if (Misc::StringUtils::ciEqual(region, playerRegion)) + setWeather(weather); + } } void WeatherManager::modRegion(const std::string ®ionid, const std::vector &chances)