remove some unneeded catch { ... }
these catch were once added to put a send_data() there now they are no longer needed. Also calling saved_game_.clear(); is not needed there either.
This commit is contained in:
parent
f3c48ab8ce
commit
e8af57e3ab
2 changed files with 28 additions and 44 deletions
|
@ -129,50 +129,40 @@ void playmp_controller::play_human_turn()
|
|||
end_turn_enable(true);
|
||||
|
||||
while(!should_return_to_play_side()) {
|
||||
try {
|
||||
process_network_data();
|
||||
check_objectives();
|
||||
play_slice_catch();
|
||||
if(player_type_changed_) {
|
||||
// Clean undo stack if turn has to be restarted (losing control)
|
||||
if(undo_stack().can_undo()) {
|
||||
gui_->announce(_("Undoing moves not yet transmitted to the server."), font::NORMAL_COLOR);
|
||||
}
|
||||
|
||||
while(undo_stack().can_undo()) {
|
||||
undo_stack().undo();
|
||||
}
|
||||
process_network_data();
|
||||
check_objectives();
|
||||
play_slice_catch();
|
||||
if(player_type_changed_) {
|
||||
// Clean undo stack if turn has to be restarted (losing control)
|
||||
if(undo_stack().can_undo()) {
|
||||
gui_->announce(_("Undoing moves not yet transmitted to the server."), font::NORMAL_COLOR);
|
||||
}
|
||||
|
||||
if(timer) {
|
||||
bool time_left = timer->update();
|
||||
if(!time_left) {
|
||||
end_turn_requested_ = true;
|
||||
}
|
||||
while(undo_stack().can_undo()) {
|
||||
undo_stack().undo();
|
||||
}
|
||||
}
|
||||
|
||||
if(timer) {
|
||||
bool time_left = timer->update();
|
||||
if(!time_left) {
|
||||
end_turn_requested_ = true;
|
||||
}
|
||||
} catch(...) {
|
||||
DBG_NG << "Caught exception while playing a side: " << utils::get_unknown_exception_type();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void playmp_controller::play_idle_loop()
|
||||
{
|
||||
LOG_NG << "playmp::play_human_turn...";
|
||||
LOG_NG << "playmp::play_idle_loop...";
|
||||
|
||||
remove_blindfold();
|
||||
|
||||
while(!should_return_to_play_side()) {
|
||||
try {
|
||||
process_network_data();
|
||||
play_slice_catch();
|
||||
using namespace std::chrono_literals;
|
||||
std::this_thread::sleep_for(1ms); // TODO: why?
|
||||
} catch(...) {
|
||||
DBG_NG << "Caught exception while playing idle loop: " << utils::get_unknown_exception_type();
|
||||
throw;
|
||||
}
|
||||
process_network_data();
|
||||
play_slice_catch();
|
||||
using namespace std::chrono_literals;
|
||||
std::this_thread::sleep_for(1ms); // TODO: why?
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -625,20 +625,14 @@ void playsingle_controller::linger()
|
|||
|
||||
update_gui_linger();
|
||||
|
||||
try {
|
||||
if(replay_controller_.get() != nullptr) {
|
||||
replay_controller_->play_side_impl();
|
||||
if(player_type_changed_) {
|
||||
replay_controller_.reset();
|
||||
}
|
||||
if(replay_controller_.get() != nullptr) {
|
||||
replay_controller_->play_side_impl();
|
||||
if(player_type_changed_) {
|
||||
replay_controller_.reset();
|
||||
}
|
||||
while(!end_turn_requested_) {
|
||||
play_slice();
|
||||
}
|
||||
} catch(const savegame::load_game_exception&) {
|
||||
// Loading a new game is effectively a quit.
|
||||
saved_game_.clear();
|
||||
throw;
|
||||
}
|
||||
while(!end_turn_requested_) {
|
||||
play_slice();
|
||||
}
|
||||
|
||||
LOG_NG << "ending end-of-scenario linger";
|
||||
|
|
Loading…
Add table
Reference in a new issue