From 22bd287b5ff6b9f2069a5e6d00fe033de4f3736a Mon Sep 17 00:00:00 2001 From: Josef Redinger Date: Sun, 24 Sep 2006 19:42:57 +0000 Subject: [PATCH] add cancel button to dialog about corrupted file during playing --- src/play_controller.cpp | 4 +++- src/replay_controller.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/play_controller.cpp b/src/play_controller.cpp index 7fad49e2828..e61d15b58d7 100644 --- a/src/play_controller.cpp +++ b/src/play_controller.cpp @@ -372,7 +372,9 @@ bool play_controller::do_replay(const bool replaying){ result = ::do_replay(*gui_,map_,gameinfo_,units_,teams_, player_number_,status_,gamestate_); } catch(replay::error&) { - gui::show_dialog(*gui_,NULL,"",_("The file you have tried to load is corrupt"),gui::OK_ONLY); + //in next version after string freeze add to text ". continue playing?" + if(gui::show_dialog(*gui_,NULL,"",_("The file you have tried to load is corrupt"),gui::OK_CANCEL)) + throw; result = false; } diff --git a/src/replay_controller.cpp b/src/replay_controller.cpp index 03a330ac485..89626b653fc 100644 --- a/src/replay_controller.cpp +++ b/src/replay_controller.cpp @@ -217,8 +217,14 @@ void replay_controller::play_replay(){ LOG_NG << "starting main loop\n" << (SDL_GetTicks() - ticks_) << "\n"; for(; !recorder.at_end() && is_playing_; first_player_ = 1 ) { + try{ play_turn(); play_slice(); + } + catch (replay::error&) //when user due to error want stop playing + { + is_playing_ = false; + } } //end for loop is_playing_ = false; }