clang-tidy readability
This commit is contained in:
@@ -40,20 +40,22 @@ void ServiceMenu::toggle() {
|
||||
}
|
||||
|
||||
void ServiceMenu::render() {
|
||||
if (!enabled_)
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
renderer_->render(this);
|
||||
|
||||
// El mensaje de reinicio se dibuja por encima, así que lo gestionamos aquí
|
||||
const float MSG_X = param.game.game_area.center_x;
|
||||
const float MSG_Y = renderer_->getRect().y + 39.0f;
|
||||
const float MSG_Y = renderer_->getRect().y + 39.0F;
|
||||
restart_message_ui_->setPosition(MSG_X, MSG_Y);
|
||||
restart_message_ui_->render();
|
||||
}
|
||||
|
||||
void ServiceMenu::update() {
|
||||
if (!enabled_)
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
|
||||
renderer_->update(this);
|
||||
|
||||
@@ -77,22 +79,25 @@ void ServiceMenu::reset() {
|
||||
|
||||
// --- Lógica de Navegación ---
|
||||
void ServiceMenu::setSelectorUp() {
|
||||
if (display_options_.empty())
|
||||
if (display_options_.empty()) {
|
||||
return;
|
||||
}
|
||||
selected_ = (selected_ > 0) ? selected_ - 1 : display_options_.size() - 1;
|
||||
playMoveSound();
|
||||
}
|
||||
|
||||
void ServiceMenu::setSelectorDown() {
|
||||
if (display_options_.empty())
|
||||
if (display_options_.empty()) {
|
||||
return;
|
||||
}
|
||||
selected_ = (selected_ + 1) % display_options_.size();
|
||||
playMoveSound();
|
||||
}
|
||||
|
||||
void ServiceMenu::adjustOption(bool adjust_up) {
|
||||
if (display_options_.empty())
|
||||
if (display_options_.empty()) {
|
||||
return;
|
||||
}
|
||||
auto &selected_option = display_options_.at(selected_);
|
||||
if (selected_option->getBehavior() == MenuOption::Behavior::ADJUST) {
|
||||
selected_option->adjustValue(adjust_up);
|
||||
@@ -102,18 +107,20 @@ void ServiceMenu::adjustOption(bool adjust_up) {
|
||||
}
|
||||
|
||||
void ServiceMenu::selectOption() {
|
||||
if (display_options_.empty())
|
||||
if (display_options_.empty()) {
|
||||
return;
|
||||
if (current_settings_group_ == SettingsGroup::MAIN)
|
||||
}
|
||||
if (current_settings_group_ == SettingsGroup::MAIN) {
|
||||
main_menu_selected_ = selected_;
|
||||
|
||||
}
|
||||
|
||||
auto *selected_option = display_options_.at(selected_);
|
||||
if (!selected_option) {
|
||||
if (selected_option == nullptr) {
|
||||
// This shouldn't happen in normal operation, but protects against null pointer
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto folder = dynamic_cast<FolderOption *>(selected_option)) {
|
||||
|
||||
if (auto *folder = dynamic_cast<FolderOption *>(selected_option)) {
|
||||
previous_settings_group_ = current_settings_group_;
|
||||
current_settings_group_ = folder->getTargetGroup();
|
||||
selected_ = 0;
|
||||
@@ -166,12 +173,15 @@ void ServiceMenu::updateMenu() {
|
||||
}
|
||||
|
||||
void ServiceMenu::applySettings() {
|
||||
if (current_settings_group_ == SettingsGroup::VIDEO)
|
||||
if (current_settings_group_ == SettingsGroup::VIDEO) {
|
||||
applyVideoSettings();
|
||||
if (current_settings_group_ == SettingsGroup::AUDIO)
|
||||
}
|
||||
if (current_settings_group_ == SettingsGroup::AUDIO) {
|
||||
applyAudioSettings();
|
||||
if (current_settings_group_ == SettingsGroup::SETTINGS)
|
||||
}
|
||||
if (current_settings_group_ == SettingsGroup::SETTINGS) {
|
||||
applySettingsSettings();
|
||||
}
|
||||
|
||||
// Actualiza los valores de las opciones
|
||||
updateOptionPairs();
|
||||
@@ -262,7 +272,7 @@ void ServiceMenu::initializeOptions() {
|
||||
// Sincroniza los valores de las opciones tipo lista
|
||||
void ServiceMenu::adjustListValues() {
|
||||
for (auto &option : options_) {
|
||||
if (auto list_option = dynamic_cast<ListOption *>(option.get())) {
|
||||
if (auto *list_option = dynamic_cast<ListOption *>(option.get())) {
|
||||
list_option->sync();
|
||||
}
|
||||
}
|
||||
@@ -275,7 +285,7 @@ void ServiceMenu::playSelectSound() { Audio::get()->playSound("service_menu_sele
|
||||
void ServiceMenu::playBackSound() { Audio::get()->playSound("service_menu_select.wav", Audio::Group::INTERFACE); }
|
||||
|
||||
// Devuelve el nombre del grupo como string para el título
|
||||
auto ServiceMenu::settingsGroupToString(SettingsGroup group) const -> std::string {
|
||||
auto ServiceMenu::settingsGroupToString(SettingsGroup group) -> std::string {
|
||||
switch (group) {
|
||||
case SettingsGroup::MAIN:
|
||||
return Lang::getText("[SERVICE_MENU] TITLE");
|
||||
@@ -295,15 +305,17 @@ auto ServiceMenu::settingsGroupToString(SettingsGroup group) const -> std::strin
|
||||
// Establece el estado de oculto de ciertas opciones
|
||||
void ServiceMenu::setHiddenOptions() {
|
||||
{
|
||||
auto option = getOptionByCaption(Lang::getText("[SERVICE_MENU] WINDOW_SIZE"));
|
||||
if (option)
|
||||
auto *option = getOptionByCaption(Lang::getText("[SERVICE_MENU] WINDOW_SIZE"));
|
||||
if (option != nullptr) {
|
||||
option->setHidden(Options::video.fullscreen);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto option = getOptionByCaption(Lang::getText("[SERVICE_MENU] SHUTDOWN"));
|
||||
if (option)
|
||||
auto *option = getOptionByCaption(Lang::getText("[SERVICE_MENU] SHUTDOWN"));
|
||||
if (option != nullptr) {
|
||||
option->setHidden(!Options::settings.shutdown_enabled);
|
||||
}
|
||||
}
|
||||
|
||||
updateMenu(); // El menú debe refrescarse si algo se oculta
|
||||
|
||||
Reference in New Issue
Block a user