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:
10
util.cpp
10
util.cpp
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user