1
0
mirror of https://github.com/luanti-org/minetestmapper.git synced 2025-10-05 21:35:22 +02:00

Some more code modernization

also a few small performance improvements
This commit is contained in:
sfan5
2020-05-08 22:10:49 +02:00
parent 2979dc5b6b
commit 8e83ce6464
21 changed files with 149 additions and 199 deletions

View File

@@ -43,3 +43,13 @@ std::string read_setting(const std::string &name, std::istream &is)
oss << "Setting '" << name << "' not found";
throw std::runtime_error(oss.str());
}
std::string read_setting_default(const std::string &name, std::istream &is,
const std::string &def)
{
try {
return read_setting(name, is);
} catch(const std::runtime_error &e) {
return def;
}
}