clang-tidy (amb el fuck de que no feien bona parella el clang de macos i el tidy de llvm)
This commit is contained in:
204
source/param.cpp
204
source/param.cpp
@@ -88,109 +88,109 @@ namespace {
|
||||
auto setParams(const std::string& var, const std::string& value) -> bool {
|
||||
// Mapas estáticos para diferentes tipos de parámetros
|
||||
static const std::unordered_map<std::string, std::function<void(const std::string&)>> INT_PARAMS = {
|
||||
{"game.width", [](const std::string& v) { param.game.width = std::stoi(v); }},
|
||||
{"game.height", [](const std::string& v) { param.game.height = std::stoi(v); }},
|
||||
{"game.play_area.rect.x", [](const std::string& v) { param.game.play_area.rect.x = std::stoi(v); }},
|
||||
{"game.play_area.rect.y", [](const std::string& v) { param.game.play_area.rect.y = std::stoi(v); }},
|
||||
{"game.play_area.rect.w", [](const std::string& v) { param.game.play_area.rect.w = std::stoi(v); }},
|
||||
{"game.play_area.rect.h", [](const std::string& v) { param.game.play_area.rect.h = std::stoi(v); }},
|
||||
{"game.name_entry_idle_time", [](const std::string& v) { param.game.name_entry_idle_time = std::stoi(v); }},
|
||||
{"game.name_entry_total_time", [](const std::string& v) { param.game.name_entry_total_time = std::stoi(v); }},
|
||||
{"fade.num_squares_width", [](const std::string& v) { param.fade.num_squares_width = std::stoi(v); }},
|
||||
{"fade.num_squares_height", [](const std::string& v) { param.fade.num_squares_height = std::stoi(v); }},
|
||||
{"fade.random_squares_duration_ms", [](const std::string& v) { param.fade.random_squares_duration_ms = std::stoi(v); }},
|
||||
{"fade.post_duration_ms", [](const std::string& v) { param.fade.post_duration_ms = std::stoi(v); }},
|
||||
{"fade.venetian_size", [](const std::string& v) { param.fade.venetian_size = std::stoi(v); }},
|
||||
{"scoreboard.rect.x", [](const std::string& v) { param.scoreboard.rect.x = std::stoi(v); }},
|
||||
{"scoreboard.rect.y", [](const std::string& v) { param.scoreboard.rect.y = std::stoi(v); }},
|
||||
{"scoreboard.rect.w", [](const std::string& v) { param.scoreboard.rect.w = std::stoi(v); }},
|
||||
{"scoreboard.rect.h", [](const std::string& v) { param.scoreboard.rect.h = std::stoi(v); }},
|
||||
{"scoreboard.skip_countdown_value", [](const std::string& v) { param.scoreboard.skip_countdown_value = std::stoi(v); }},
|
||||
{"title.press_start_position", [](const std::string& v) { param.title.press_start_position = std::stoi(v); }},
|
||||
{"title.arcade_edition_position", [](const std::string& v) { param.title.arcade_edition_position = std::stoi(v); }},
|
||||
{"title.title_c_c_position", [](const std::string& v) { param.title.title_c_c_position = std::stoi(v); }},
|
||||
{"intro.text_distance_from_bottom", [](const std::string& v) { param.intro.text_distance_from_bottom = std::stoi(v); }}};
|
||||
{"game.width", [](const std::string& v) -> void { param.game.width = std::stoi(v); }},
|
||||
{"game.height", [](const std::string& v) -> void { param.game.height = std::stoi(v); }},
|
||||
{"game.play_area.rect.x", [](const std::string& v) -> void { param.game.play_area.rect.x = std::stoi(v); }},
|
||||
{"game.play_area.rect.y", [](const std::string& v) -> void { param.game.play_area.rect.y = std::stoi(v); }},
|
||||
{"game.play_area.rect.w", [](const std::string& v) -> void { param.game.play_area.rect.w = std::stoi(v); }},
|
||||
{"game.play_area.rect.h", [](const std::string& v) -> void { param.game.play_area.rect.h = std::stoi(v); }},
|
||||
{"game.name_entry_idle_time", [](const std::string& v) -> void { param.game.name_entry_idle_time = std::stoi(v); }},
|
||||
{"game.name_entry_total_time", [](const std::string& v) -> void { param.game.name_entry_total_time = std::stoi(v); }},
|
||||
{"fade.num_squares_width", [](const std::string& v) -> void { param.fade.num_squares_width = std::stoi(v); }},
|
||||
{"fade.num_squares_height", [](const std::string& v) -> void { param.fade.num_squares_height = std::stoi(v); }},
|
||||
{"fade.random_squares_duration_ms", [](const std::string& v) -> void { param.fade.random_squares_duration_ms = std::stoi(v); }},
|
||||
{"fade.post_duration_ms", [](const std::string& v) -> void { param.fade.post_duration_ms = std::stoi(v); }},
|
||||
{"fade.venetian_size", [](const std::string& v) -> void { param.fade.venetian_size = std::stoi(v); }},
|
||||
{"scoreboard.rect.x", [](const std::string& v) -> void { param.scoreboard.rect.x = std::stoi(v); }},
|
||||
{"scoreboard.rect.y", [](const std::string& v) -> void { param.scoreboard.rect.y = std::stoi(v); }},
|
||||
{"scoreboard.rect.w", [](const std::string& v) -> void { param.scoreboard.rect.w = std::stoi(v); }},
|
||||
{"scoreboard.rect.h", [](const std::string& v) -> void { param.scoreboard.rect.h = std::stoi(v); }},
|
||||
{"scoreboard.skip_countdown_value", [](const std::string& v) -> void { param.scoreboard.skip_countdown_value = std::stoi(v); }},
|
||||
{"title.press_start_position", [](const std::string& v) -> void { param.title.press_start_position = std::stoi(v); }},
|
||||
{"title.arcade_edition_position", [](const std::string& v) -> void { param.title.arcade_edition_position = std::stoi(v); }},
|
||||
{"title.title_c_c_position", [](const std::string& v) -> void { param.title.title_c_c_position = std::stoi(v); }},
|
||||
{"intro.text_distance_from_bottom", [](const std::string& v) -> void { param.intro.text_distance_from_bottom = std::stoi(v); }}};
|
||||
|
||||
static const std::unordered_map<std::string, std::function<void(const std::string&)>> COLOR_PARAMS = {
|
||||
{"fade.color", [](const std::string& v) { param.fade.color = Color::fromHex(v); }},
|
||||
{"scoreboard.separator_color", [](const std::string& v) { param.scoreboard.separator_color = Color::fromHex(v); }},
|
||||
{"scoreboard.easy_color", [](const std::string& v) { param.scoreboard.easy_color = Color::fromHex(v); }},
|
||||
{"scoreboard.normal_color", [](const std::string& v) { param.scoreboard.normal_color = Color::fromHex(v); }},
|
||||
{"scoreboard.hard_color", [](const std::string& v) { param.scoreboard.hard_color = Color::fromHex(v); }},
|
||||
{"scoreboard.text_color1", [](const std::string& v) { param.scoreboard.text_color1 = Color::fromHex(v); }},
|
||||
{"scoreboard.text_color2", [](const std::string& v) { param.scoreboard.text_color2 = Color::fromHex(v); }},
|
||||
{"title.bg_color", [](const std::string& v) { param.title.bg_color = Color::fromHex(v); }},
|
||||
{"background.attenuate_color", [](const std::string& v) { param.background.attenuate_color = Color::fromHex(v); }},
|
||||
{"notification.color", [](const std::string& v) { param.notification.color = Color::fromHex(v); }},
|
||||
{"service_menu.title_color", [](const std::string& v) { param.service_menu.title_color = Color::fromHex(v); }},
|
||||
{"service_menu.text_color", [](const std::string& v) { param.service_menu.text_color = Color::fromHex(v); }},
|
||||
{"service_menu.selected_color", [](const std::string& v) { param.service_menu.selected_color = Color::fromHex(v); }},
|
||||
{"service_menu.bg_color", [](const std::string& v) { param.service_menu.bg_color = Color::fromHex(v); }},
|
||||
{"service_menu.window_message.bg_color", [](const std::string& v) { param.service_menu.window_message.bg_color = Color::fromHex(v); }},
|
||||
{"service_menu.window_message.border_color", [](const std::string& v) { param.service_menu.window_message.border_color = Color::fromHex(v); }},
|
||||
{"service_menu.window_message.title_color", [](const std::string& v) { param.service_menu.window_message.title_color = Color::fromHex(v); }},
|
||||
{"service_menu.window_message.text_color", [](const std::string& v) { param.service_menu.window_message.text_color = Color::fromHex(v); }},
|
||||
{"intro.bg_color", [](const std::string& v) { param.intro.bg_color = Color::fromHex(v); }},
|
||||
{"intro.card_color", [](const std::string& v) { param.intro.card_color = Color::fromHex(v); }},
|
||||
{"intro.shadow_color", [](const std::string& v) { param.intro.shadow_color = Color::fromHex(v); }},
|
||||
{"debug.color", [](const std::string& v) { param.debug.color = Color::fromHex(v); }},
|
||||
{"resource.color", [](const std::string& v) { param.resource.color = Color::fromHex(v); }},
|
||||
{"game.item_text_outline_color", [](const std::string& v) { param.game.item_text_outline_color = Color::fromHex(v); }},
|
||||
{"player.default_shirt[0].darkest", [](const std::string& v) { param.player.default_shirt[0].darkest = Color::fromHex(v); }},
|
||||
{"player.default_shirt[0].dark", [](const std::string& v) { param.player.default_shirt[0].dark = Color::fromHex(v); }},
|
||||
{"player.default_shirt[0].base", [](const std::string& v) { param.player.default_shirt[0].base = Color::fromHex(v); }},
|
||||
{"player.default_shirt[0].light", [](const std::string& v) { param.player.default_shirt[0].light = Color::fromHex(v); }},
|
||||
{"player.default_shirt[1].darkest", [](const std::string& v) { param.player.default_shirt[1].darkest = Color::fromHex(v); }},
|
||||
{"player.default_shirt[1].dark", [](const std::string& v) { param.player.default_shirt[1].dark = Color::fromHex(v); }},
|
||||
{"player.default_shirt[1].base", [](const std::string& v) { param.player.default_shirt[1].base = Color::fromHex(v); }},
|
||||
{"player.default_shirt[1].light", [](const std::string& v) { param.player.default_shirt[1].light = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[0].darkest", [](const std::string& v) { param.player.one_coffee_shirt[0].darkest = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[0].dark", [](const std::string& v) { param.player.one_coffee_shirt[0].dark = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[0].base", [](const std::string& v) { param.player.one_coffee_shirt[0].base = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[0].light", [](const std::string& v) { param.player.one_coffee_shirt[0].light = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[1].darkest", [](const std::string& v) { param.player.one_coffee_shirt[1].darkest = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[1].dark", [](const std::string& v) { param.player.one_coffee_shirt[1].dark = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[1].base", [](const std::string& v) { param.player.one_coffee_shirt[1].base = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[1].light", [](const std::string& v) { param.player.one_coffee_shirt[1].light = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[0].darkest", [](const std::string& v) { param.player.two_coffee_shirt[0].darkest = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[0].dark", [](const std::string& v) { param.player.two_coffee_shirt[0].dark = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[0].base", [](const std::string& v) { param.player.two_coffee_shirt[0].base = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[0].light", [](const std::string& v) { param.player.two_coffee_shirt[0].light = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[1].darkest", [](const std::string& v) { param.player.two_coffee_shirt[1].darkest = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[1].dark", [](const std::string& v) { param.player.two_coffee_shirt[1].dark = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[1].base", [](const std::string& v) { param.player.two_coffee_shirt[1].base = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[1].light", [](const std::string& v) { param.player.two_coffee_shirt[1].light = Color::fromHex(v); }},
|
||||
{"player.outline_color[0]", [](const std::string& v) { param.player.outline_color[0] = Color::fromHex(v); }},
|
||||
{"player.outline_color[1]", [](const std::string& v) { param.player.outline_color[1] = Color::fromHex(v); }}};
|
||||
{"fade.color", [](const std::string& v) -> void { param.fade.color = Color::fromHex(v); }},
|
||||
{"scoreboard.separator_color", [](const std::string& v) -> void { param.scoreboard.separator_color = Color::fromHex(v); }},
|
||||
{"scoreboard.easy_color", [](const std::string& v) -> void { param.scoreboard.easy_color = Color::fromHex(v); }},
|
||||
{"scoreboard.normal_color", [](const std::string& v) -> void { param.scoreboard.normal_color = Color::fromHex(v); }},
|
||||
{"scoreboard.hard_color", [](const std::string& v) -> void { param.scoreboard.hard_color = Color::fromHex(v); }},
|
||||
{"scoreboard.text_color1", [](const std::string& v) -> void { param.scoreboard.text_color1 = Color::fromHex(v); }},
|
||||
{"scoreboard.text_color2", [](const std::string& v) -> void { param.scoreboard.text_color2 = Color::fromHex(v); }},
|
||||
{"title.bg_color", [](const std::string& v) -> void { param.title.bg_color = Color::fromHex(v); }},
|
||||
{"background.attenuate_color", [](const std::string& v) -> void { param.background.attenuate_color = Color::fromHex(v); }},
|
||||
{"notification.color", [](const std::string& v) -> void { param.notification.color = Color::fromHex(v); }},
|
||||
{"service_menu.title_color", [](const std::string& v) -> void { param.service_menu.title_color = Color::fromHex(v); }},
|
||||
{"service_menu.text_color", [](const std::string& v) -> void { param.service_menu.text_color = Color::fromHex(v); }},
|
||||
{"service_menu.selected_color", [](const std::string& v) -> void { param.service_menu.selected_color = Color::fromHex(v); }},
|
||||
{"service_menu.bg_color", [](const std::string& v) -> void { param.service_menu.bg_color = Color::fromHex(v); }},
|
||||
{"service_menu.window_message.bg_color", [](const std::string& v) -> void { param.service_menu.window_message.bg_color = Color::fromHex(v); }},
|
||||
{"service_menu.window_message.border_color", [](const std::string& v) -> void { param.service_menu.window_message.border_color = Color::fromHex(v); }},
|
||||
{"service_menu.window_message.title_color", [](const std::string& v) -> void { param.service_menu.window_message.title_color = Color::fromHex(v); }},
|
||||
{"service_menu.window_message.text_color", [](const std::string& v) -> void { param.service_menu.window_message.text_color = Color::fromHex(v); }},
|
||||
{"intro.bg_color", [](const std::string& v) -> void { param.intro.bg_color = Color::fromHex(v); }},
|
||||
{"intro.card_color", [](const std::string& v) -> void { param.intro.card_color = Color::fromHex(v); }},
|
||||
{"intro.shadow_color", [](const std::string& v) -> void { param.intro.shadow_color = Color::fromHex(v); }},
|
||||
{"debug.color", [](const std::string& v) -> void { param.debug.color = Color::fromHex(v); }},
|
||||
{"resource.color", [](const std::string& v) -> void { param.resource.color = Color::fromHex(v); }},
|
||||
{"game.item_text_outline_color", [](const std::string& v) -> void { param.game.item_text_outline_color = Color::fromHex(v); }},
|
||||
{"player.default_shirt[0].darkest", [](const std::string& v) -> void { param.player.default_shirt[0].darkest = Color::fromHex(v); }},
|
||||
{"player.default_shirt[0].dark", [](const std::string& v) -> void { param.player.default_shirt[0].dark = Color::fromHex(v); }},
|
||||
{"player.default_shirt[0].base", [](const std::string& v) -> void { param.player.default_shirt[0].base = Color::fromHex(v); }},
|
||||
{"player.default_shirt[0].light", [](const std::string& v) -> void { param.player.default_shirt[0].light = Color::fromHex(v); }},
|
||||
{"player.default_shirt[1].darkest", [](const std::string& v) -> void { param.player.default_shirt[1].darkest = Color::fromHex(v); }},
|
||||
{"player.default_shirt[1].dark", [](const std::string& v) -> void { param.player.default_shirt[1].dark = Color::fromHex(v); }},
|
||||
{"player.default_shirt[1].base", [](const std::string& v) -> void { param.player.default_shirt[1].base = Color::fromHex(v); }},
|
||||
{"player.default_shirt[1].light", [](const std::string& v) -> void { param.player.default_shirt[1].light = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[0].darkest", [](const std::string& v) -> void { param.player.one_coffee_shirt[0].darkest = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[0].dark", [](const std::string& v) -> void { param.player.one_coffee_shirt[0].dark = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[0].base", [](const std::string& v) -> void { param.player.one_coffee_shirt[0].base = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[0].light", [](const std::string& v) -> void { param.player.one_coffee_shirt[0].light = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[1].darkest", [](const std::string& v) -> void { param.player.one_coffee_shirt[1].darkest = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[1].dark", [](const std::string& v) -> void { param.player.one_coffee_shirt[1].dark = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[1].base", [](const std::string& v) -> void { param.player.one_coffee_shirt[1].base = Color::fromHex(v); }},
|
||||
{"player.one_coffee_shirt[1].light", [](const std::string& v) -> void { param.player.one_coffee_shirt[1].light = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[0].darkest", [](const std::string& v) -> void { param.player.two_coffee_shirt[0].darkest = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[0].dark", [](const std::string& v) -> void { param.player.two_coffee_shirt[0].dark = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[0].base", [](const std::string& v) -> void { param.player.two_coffee_shirt[0].base = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[0].light", [](const std::string& v) -> void { param.player.two_coffee_shirt[0].light = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[1].darkest", [](const std::string& v) -> void { param.player.two_coffee_shirt[1].darkest = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[1].dark", [](const std::string& v) -> void { param.player.two_coffee_shirt[1].dark = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[1].base", [](const std::string& v) -> void { param.player.two_coffee_shirt[1].base = Color::fromHex(v); }},
|
||||
{"player.two_coffee_shirt[1].light", [](const std::string& v) -> void { param.player.two_coffee_shirt[1].light = Color::fromHex(v); }},
|
||||
{"player.outline_color[0]", [](const std::string& v) -> void { param.player.outline_color[0] = Color::fromHex(v); }},
|
||||
{"player.outline_color[1]", [](const std::string& v) -> void { param.player.outline_color[1] = Color::fromHex(v); }}};
|
||||
|
||||
static const std::unordered_map<std::string, std::function<void(const std::string&)>> BOOL_PARAMS = {
|
||||
{"scoreboard.separator_autocolor", [](const std::string& v) { param.scoreboard.separator_autocolor = stringToBool(v); }},
|
||||
{"scoreboard.text_autocolor", [](const std::string& v) { param.scoreboard.text_autocolor = stringToBool(v); }},
|
||||
{"balloon.bouncing_sound", [](const std::string& v) { param.balloon.bouncing_sound = stringToBool(v); }},
|
||||
{"notification.sound", [](const std::string& v) { param.notification.sound = stringToBool(v); }},
|
||||
{"service_menu.drop_shadow", [](const std::string& v) { param.service_menu.drop_shadow = stringToBool(v); }}};
|
||||
{"scoreboard.separator_autocolor", [](const std::string& v) -> void { param.scoreboard.separator_autocolor = stringToBool(v); }},
|
||||
{"scoreboard.text_autocolor", [](const std::string& v) -> void { param.scoreboard.text_autocolor = stringToBool(v); }},
|
||||
{"balloon.bouncing_sound", [](const std::string& v) -> void { param.balloon.bouncing_sound = stringToBool(v); }},
|
||||
{"notification.sound", [](const std::string& v) -> void { param.notification.sound = stringToBool(v); }},
|
||||
{"service_menu.drop_shadow", [](const std::string& v) -> void { param.service_menu.drop_shadow = stringToBool(v); }}};
|
||||
|
||||
static const std::unordered_map<std::string, std::function<void(const std::string&)>> FLOAT_PARAMS = {
|
||||
{"balloon.settings[0].vel", [](const std::string& v) { param.balloon.settings.at(0).vel = std::stof(v); }},
|
||||
{"balloon.settings[0].grav", [](const std::string& v) { param.balloon.settings.at(0).grav = std::stof(v); }},
|
||||
{"balloon.settings[1].vel", [](const std::string& v) { param.balloon.settings.at(1).vel = std::stof(v); }},
|
||||
{"balloon.settings[1].grav", [](const std::string& v) { param.balloon.settings.at(1).grav = std::stof(v); }},
|
||||
{"balloon.settings[2].vel", [](const std::string& v) { param.balloon.settings.at(2).vel = std::stof(v); }},
|
||||
{"balloon.settings[2].grav", [](const std::string& v) { param.balloon.settings.at(2).grav = std::stof(v); }},
|
||||
{"balloon.settings[3].vel", [](const std::string& v) { param.balloon.settings.at(3).vel = std::stof(v); }},
|
||||
{"balloon.settings[3].grav", [](const std::string& v) { param.balloon.settings.at(3).grav = std::stof(v); }},
|
||||
{"tabe.min_spawn_time", [](const std::string& v) { param.tabe.min_spawn_time = std::stof(v); }},
|
||||
{"tabe.max_spawn_time", [](const std::string& v) { param.tabe.max_spawn_time = std::stof(v); }},
|
||||
{"title.title_duration", [](const std::string& v) { param.title.title_duration = std::stof(v); }},
|
||||
{"service_menu.window_message.padding", [](const std::string& v) { param.service_menu.window_message.padding = std::stof(v); }},
|
||||
{"service_menu.window_message.line_spacing", [](const std::string& v) { param.service_menu.window_message.line_spacing = std::stof(v); }},
|
||||
{"service_menu.window_message.title_separator_spacing", [](const std::string& v) { param.service_menu.window_message.title_separator_spacing = std::stof(v); }},
|
||||
{"service_menu.window_message.min_width", [](const std::string& v) { param.service_menu.window_message.min_width = std::stof(v); }},
|
||||
{"service_menu.window_message.min_height", [](const std::string& v) { param.service_menu.window_message.min_height = std::stof(v); }},
|
||||
{"service_menu.window_message.max_width_ratio", [](const std::string& v) { param.service_menu.window_message.max_width_ratio = std::stof(v); }},
|
||||
{"service_menu.window_message.max_height_ratio", [](const std::string& v) { param.service_menu.window_message.max_height_ratio = std::stof(v); }},
|
||||
{"service_menu.window_message.text_safety_margin", [](const std::string& v) { param.service_menu.window_message.text_safety_margin = std::stof(v); }},
|
||||
{"service_menu.window_message.animation_duration", [](const std::string& v) { param.service_menu.window_message.animation_duration = std::stof(v); }}};
|
||||
{"balloon.settings[0].vel", [](const std::string& v) -> void { param.balloon.settings.at(0).vel = std::stof(v); }},
|
||||
{"balloon.settings[0].grav", [](const std::string& v) -> void { param.balloon.settings.at(0).grav = std::stof(v); }},
|
||||
{"balloon.settings[1].vel", [](const std::string& v) -> void { param.balloon.settings.at(1).vel = std::stof(v); }},
|
||||
{"balloon.settings[1].grav", [](const std::string& v) -> void { param.balloon.settings.at(1).grav = std::stof(v); }},
|
||||
{"balloon.settings[2].vel", [](const std::string& v) -> void { param.balloon.settings.at(2).vel = std::stof(v); }},
|
||||
{"balloon.settings[2].grav", [](const std::string& v) -> void { param.balloon.settings.at(2).grav = std::stof(v); }},
|
||||
{"balloon.settings[3].vel", [](const std::string& v) -> void { param.balloon.settings.at(3).vel = std::stof(v); }},
|
||||
{"balloon.settings[3].grav", [](const std::string& v) -> void { param.balloon.settings.at(3).grav = std::stof(v); }},
|
||||
{"tabe.min_spawn_time", [](const std::string& v) -> void { param.tabe.min_spawn_time = std::stof(v); }},
|
||||
{"tabe.max_spawn_time", [](const std::string& v) -> void { param.tabe.max_spawn_time = std::stof(v); }},
|
||||
{"title.title_duration", [](const std::string& v) -> void { param.title.title_duration = std::stof(v); }},
|
||||
{"service_menu.window_message.padding", [](const std::string& v) -> void { param.service_menu.window_message.padding = std::stof(v); }},
|
||||
{"service_menu.window_message.line_spacing", [](const std::string& v) -> void { param.service_menu.window_message.line_spacing = std::stof(v); }},
|
||||
{"service_menu.window_message.title_separator_spacing", [](const std::string& v) -> void { param.service_menu.window_message.title_separator_spacing = std::stof(v); }},
|
||||
{"service_menu.window_message.min_width", [](const std::string& v) -> void { param.service_menu.window_message.min_width = std::stof(v); }},
|
||||
{"service_menu.window_message.min_height", [](const std::string& v) -> void { param.service_menu.window_message.min_height = std::stof(v); }},
|
||||
{"service_menu.window_message.max_width_ratio", [](const std::string& v) -> void { param.service_menu.window_message.max_width_ratio = std::stof(v); }},
|
||||
{"service_menu.window_message.max_height_ratio", [](const std::string& v) -> void { param.service_menu.window_message.max_height_ratio = std::stof(v); }},
|
||||
{"service_menu.window_message.text_safety_margin", [](const std::string& v) -> void { param.service_menu.window_message.text_safety_margin = std::stof(v); }},
|
||||
{"service_menu.window_message.animation_duration", [](const std::string& v) -> void { param.service_menu.window_message.animation_duration = std::stof(v); }}};
|
||||
|
||||
static const std::unordered_map<std::string, std::function<void(const std::string&)>> INT_PARAMS_EXTRA = {};
|
||||
|
||||
@@ -202,11 +202,11 @@ namespace {
|
||||
{"green", true}};
|
||||
|
||||
auto validate_balloon_color = [](const std::string& color) -> bool {
|
||||
return VALID_BALLOON_COLORS.find(color) != VALID_BALLOON_COLORS.end();
|
||||
return VALID_BALLOON_COLORS.contains(color);
|
||||
};
|
||||
|
||||
static const std::unordered_map<std::string, std::function<void(const std::string&)>> STRING_PARAMS = {
|
||||
{"balloon.color[0]", [validate_balloon_color](const std::string& v) {
|
||||
{"balloon.color[0]", [validate_balloon_color](const std::string& v) -> void {
|
||||
if (!validate_balloon_color(v)) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Color de globo inválido '%s'. Usando 'blue' por defecto.", v.c_str());
|
||||
param.balloon.color.at(0) = "blue";
|
||||
@@ -214,7 +214,7 @@ namespace {
|
||||
param.balloon.color.at(0) = v;
|
||||
}
|
||||
}},
|
||||
{"balloon.color[1]", [validate_balloon_color](const std::string& v) {
|
||||
{"balloon.color[1]", [validate_balloon_color](const std::string& v) -> void {
|
||||
if (!validate_balloon_color(v)) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Color de globo inválido '%s'. Usando 'orange' por defecto.", v.c_str());
|
||||
param.balloon.color.at(1) = "orange";
|
||||
@@ -222,7 +222,7 @@ namespace {
|
||||
param.balloon.color.at(1) = v;
|
||||
}
|
||||
}},
|
||||
{"balloon.color[2]", [validate_balloon_color](const std::string& v) {
|
||||
{"balloon.color[2]", [validate_balloon_color](const std::string& v) -> void {
|
||||
if (!validate_balloon_color(v)) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Color de globo inválido '%s'. Usando 'red' por defecto.", v.c_str());
|
||||
param.balloon.color.at(2) = "red";
|
||||
@@ -230,7 +230,7 @@ namespace {
|
||||
param.balloon.color.at(2) = v;
|
||||
}
|
||||
}},
|
||||
{"balloon.color[3]", [validate_balloon_color](const std::string& v) {
|
||||
{"balloon.color[3]", [validate_balloon_color](const std::string& v) -> void {
|
||||
if (!validate_balloon_color(v)) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Color de globo inválido '%s'. Usando 'green' por defecto.", v.c_str());
|
||||
param.balloon.color.at(3) = "green";
|
||||
|
||||
Reference in New Issue
Block a user