std::stof can not handle comma in us localization and can not handle period in french localization, using std::replace is not a solution, going back to boost::lexical_cast

pull/1318/head
Bret Curtis 8 years ago
parent f0b21cca22
commit 7c758a6293

@ -1,5 +1,8 @@
#include "fallback.hpp" #include "fallback.hpp"
#include <boost/lexical_cast.hpp>
namespace Fallback namespace Fallback
{ {
bool stob(std::string const& s) { bool stob(std::string const& s) {
@ -23,8 +26,9 @@ namespace Fallback
std::string fallback=getFallbackString(fall); std::string fallback=getFallbackString(fall);
if(fallback.empty()) if(fallback.empty())
return 0; return 0;
else else {
return std::stof(fallback); return boost::lexical_cast<float>(fallback);
}
} }
int Map::getFallbackInt(const std::string& fall) const int Map::getFallbackInt(const std::string& fall) const
{ {

Loading…
Cancel
Save