mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-09 18:16:28 +00:00
Limit variable scope.
Also avoid shadowing the variable res. Issue found by cppcheck.
This commit is contained in:
parent
6f3dd3b1e1
commit
3b1b13e96d
@ -564,14 +564,13 @@ void context_manager::save_map_as_dialog()
|
||||
}
|
||||
const std::string old_input_name = input_name;
|
||||
|
||||
int res = 0;
|
||||
int overwrite_res = 1;
|
||||
do {
|
||||
input_name = old_input_name;
|
||||
res = dialogs::show_file_chooser_dialog_save(gui_, input_name, _("Save the Map As"));
|
||||
int res = dialogs::show_file_chooser_dialog_save(gui_, input_name, _("Save the Map As"));
|
||||
if (res == 0) {
|
||||
if (file_exists(input_name)) {
|
||||
const int res = gui2::show_message(gui_.video(), "",
|
||||
res = gui2::show_message(gui_.video(), "",
|
||||
_("The file already exists. Do you want to overwrite it?"), gui2::tmessage::yes_no_buttons);
|
||||
overwrite_res = gui2::twindow::CANCEL == res ? 1 : 0;
|
||||
} else {
|
||||
@ -593,14 +592,13 @@ void context_manager::save_scenario_as_dialog()
|
||||
}
|
||||
const std::string old_input_name = input_name;
|
||||
|
||||
int res = 0;
|
||||
int overwrite_res = 1;
|
||||
do {
|
||||
input_name = old_input_name;
|
||||
res = dialogs::show_file_chooser_dialog_save(gui_, input_name, _("Save the Scenario As"));
|
||||
int res = dialogs::show_file_chooser_dialog_save(gui_, input_name, _("Save the Scenario As"));
|
||||
if (res == 0) {
|
||||
if (file_exists(input_name)) {
|
||||
const int res = gui2::show_message(gui_.video(), "",
|
||||
res = gui2::show_message(gui_.video(), "",
|
||||
_("The file already exists. Do you want to overwrite it?"), gui2::tmessage::yes_no_buttons);
|
||||
overwrite_res = gui2::twindow::CANCEL == res ? 1 : 0;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user