diff --git a/apps/openmw/mwworld/fallback.cpp b/apps/openmw/mwworld/fallback.cpp index 24ddc3db7..569a6b50c 100644 --- a/apps/openmw/mwworld/fallback.cpp +++ b/apps/openmw/mwworld/fallback.cpp @@ -2,6 +2,9 @@ #include "boost/lexical_cast.hpp" namespace MWWorld { + Fallback::Fallback(const std::map& fallback):mFallbackMap(fallback) + {} + std::string Fallback::getFallbackString(const std::string& fall) const { std::map::const_iterator it; @@ -14,7 +17,7 @@ namespace MWWorld float Fallback::getFallbackFloat(const std::string& fall) const { std::string fallback=getFallbackString(fall); - if(fallback=="") + if(fallback.empty()) return 0; else return boost::lexical_cast(fallback); @@ -22,7 +25,7 @@ namespace MWWorld bool Fallback::getFallbackBool(const std::string& fall) const { std::string fallback=getFallbackString(fall); - if(fallback=="") + if(fallback.empty()) return false; else return boost::lexical_cast(fallback); @@ -30,13 +33,13 @@ namespace MWWorld Ogre::ColourValue Fallback::getFallbackColour(const std::string& fall) const { std::string sum=getFallbackString(fall); - if(sum=="") + if(sum.empty()) return Ogre::ColourValue(0,0,0); else { std::string ret[3]; unsigned int j=0; - for(unsigned int i=0;i +#include + #include + namespace MWWorld { class Fallback { const std::map mFallbackMap; public: - Fallback(const std::map fallback):mFallbackMap(fallback){}; + Fallback(const std::map& fallback); std::string getFallbackString(const std::string& fall) const; float getFallbackFloat(const std::string& fall) const; bool getFallbackBool(const std::string& fall) const; diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 3462cfca1..867e910fe 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -12,6 +12,7 @@ #include "player.hpp" #include "esmstore.hpp" +#include "fallback.hpp" using namespace Ogre; using namespace MWWorld; diff --git a/apps/openmw/mwworld/weather.hpp b/apps/openmw/mwworld/weather.hpp index ae0c2ca93..93d908ebe 100644 --- a/apps/openmw/mwworld/weather.hpp +++ b/apps/openmw/mwworld/weather.hpp @@ -3,7 +3,7 @@ #include #include -#include "fallback.hpp" + namespace MWRender { class RenderingManager; @@ -11,6 +11,8 @@ namespace MWRender namespace MWWorld { + class Fallback; + /// Defines the actual weather that results from weather setting (see below), time of day and weather transition struct WeatherResult {