1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-14 09:05:19 +02:00

Code optimizations / refactor (#12704)

Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
Herman Semenov
2022-09-06 13:21:09 +03:00
committed by GitHub
parent ff6dcfea82
commit 038da00e79
38 changed files with 84 additions and 94 deletions

View File

@@ -484,7 +484,7 @@ static bool setup_log_params(const Settings &cmd_args)
color_mode = color_mode_env;
#endif
}
if (color_mode != "") {
if (!color_mode.empty()) {
if (color_mode == "auto") {
Logger::color_mode = LOG_COLOR_AUTO;
} else if (color_mode == "always") {
@@ -586,7 +586,7 @@ static void startup_message()
static bool read_config_file(const Settings &cmd_args)
{
// Path of configuration file in use
sanity_check(g_settings_path == ""); // Sanity check
sanity_check(g_settings_path.empty()); // Sanity check
if (cmd_args.exists("config")) {
bool r = g_settings->readConfigFile(cmd_args.get("config").c_str());
@@ -793,7 +793,7 @@ static bool auto_select_world(GameParams *game_params)
<< world_path << "]" << std::endl;
}
assert(world_path != ""); // Post-condition
assert(!world_path.empty()); // Post-condition
game_params->world_path = world_path;
return true;
}
@@ -849,7 +849,7 @@ static bool determine_subgame(GameParams *game_params)
{
SubgameSpec gamespec;
assert(game_params->world_path != ""); // Pre-condition
assert(!game_params->world_path.empty()); // Pre-condition
// If world doesn't exist
if (!game_params->world_path.empty()