1
0
forked from mirrors/0ad

Get config values without using return parameters

Many temporaries can be removed.
This commit is contained in:
phosit
2025-01-29 16:38:52 +01:00
parent 874c4d1c59
commit 1a8757660f
38 changed files with 252 additions and 379 deletions
+4 -7
View File
@@ -285,8 +285,8 @@ inline static void LimitFPS()
if (g_VideoMode.IsVSyncEnabled())
return;
double fpsLimit = 0.0;
CFG_GET_VAL(g_Game && g_Game->IsGameStarted() ? "adaptivefps.session" : "adaptivefps.menu", fpsLimit);
const double fpsLimit{
g_ConfigDB.Get(g_Game && g_Game->IsGameStarted() ? "adaptivefps.session" : "adaptivefps.menu", 0.0)};
// Keep in sync with options.json
if (fpsLimit < 20.0 || fpsLimit >= 360.0)
@@ -497,11 +497,8 @@ static std::optional<RL::Interface> CreateRLInterface(const CmdLineArgs& args)
if (!args.Has("rl-interface"))
return std::nullopt;
std::string server_address;
CFG_GET_VAL("rlinterface.address", server_address);
if (!args.Get("rl-interface").empty())
server_address = args.Get("rl-interface");
const std::string server_address{args.Get("rl-interface").empty() ?
g_ConfigDB.Get("rlinterface.address", std::string{}) : args.Get("rl-interface")};
debug_printf("RL interface listening on %s\n", server_address.c_str());
return std::make_optional<RL::Interface>(server_address.c_str());