typo; World::getFallback(std::string key, std::string def)

This commit is contained in:
Sebastian Wick 2012-04-04 16:15:15 +02:00
parent 16e7bf353a
commit 48b7b03453
3 changed files with 9 additions and 2 deletions

View file

@ -71,7 +71,7 @@ void validate(boost::any &v, std::vector<std::string> const &tokens, FallbackMap
for(std::vector<std::string>::const_iterator it=tokens.begin(); it != tokens.end(); it++)
{
int sep = it->find(",");
if(sep < 1 || sep = it->length()-1)
if(sep < 1 || sep == (it->length()-1))
throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value);
std::string key(it->substr(0,sep));

View file

@ -158,11 +158,16 @@ namespace MWWorld
}
std::string World::getFallback(std::string key)
{
return getFallback(key, "");
}
std::string World::getFallback(std::string key, std::string def)
{
std::map<std::string,std::string>::iterator it;
if((it = mFallback.find(key)) == mFallback.end())
{
return std::string("");
return def;
}
return it->second;
}

View file

@ -130,6 +130,8 @@ namespace MWWorld
std::string getFallback(std::string key);
std::string getFallback(std::string key, std::string def);
MWWorld::Player& getPlayer();
const ESMS::ESMStore& getStore() const;