fix bug #4835, save game dialog complaining of bad name even on cancel
This commit is contained in:
parent
c35f372c58
commit
ae5e491011
2 changed files with 14 additions and 12 deletions
|
@ -303,13 +303,14 @@ namespace events{
|
|||
|
||||
const int res = dialog_type == gui::NULL_DIALOG ? 0 : dialogs::get_save_name(gui,message,_("Name:"),&label,dialog_type);
|
||||
|
||||
if(std::count_if(label.begin(),label.end(),is_illegal_file_char)) {
|
||||
gui::show_dialog(gui,NULL,_("Error"),_("Save names may not contain colons, slashes, or backslashes. Please choose a different name."),gui::OK_ONLY);
|
||||
save_game(message,dialog_type, gamestate, status, gui, level, teams, units, map);
|
||||
return;
|
||||
}
|
||||
|
||||
if(res == 0) {
|
||||
|
||||
if(std::count_if(label.begin(),label.end(),is_illegal_file_char)) {
|
||||
gui::show_dialog(gui,NULL,_("Error"),_("Save names may not contain colons, slashes, or backslashes. Please choose a different name."),gui::OK_ONLY);
|
||||
save_game(message,dialog_type, gamestate, status, gui, level, teams, units, map);
|
||||
return;
|
||||
}
|
||||
|
||||
config snapshot;
|
||||
write_game_snapshot(snapshot, level, gui, teams, units, status, gamestate, map);
|
||||
try {
|
||||
|
|
|
@ -1616,13 +1616,14 @@ void turn_info::save_game(const std::string& message, gui::DIALOG_TYPE dialog_ty
|
|||
|
||||
const int res = dialog_type == gui::NULL_DIALOG ? 0 : dialogs::get_save_name(gui_,message,_("Name:"),&label,dialog_type);
|
||||
|
||||
if(std::count_if(label.begin(),label.end(),is_illegal_file_char)) {
|
||||
gui::show_dialog(gui_,NULL,_("Error"),_("Save names may not contain colons, slashes, or backslashes. Please choose a different name."),gui::OK_ONLY);
|
||||
save_game(message,dialog_type);
|
||||
return;
|
||||
}
|
||||
|
||||
if(res == 0) {
|
||||
|
||||
if(std::count_if(label.begin(),label.end(),is_illegal_file_char)) {
|
||||
gui::show_dialog(gui_,NULL,_("Error"),_("Save names may not contain colons, slashes, or backslashes. Please choose a different name."),gui::OK_ONLY);
|
||||
save_game(message,dialog_type);
|
||||
return;
|
||||
}
|
||||
|
||||
config snapshot;
|
||||
write_game_snapshot(snapshot);
|
||||
try {
|
||||
|
|
Loading…
Add table
Reference in a new issue