void playsingle_controller::linger() { LOG_NG << "beginning end-of-scenario linger\n"; browse_ = true; linger_ = true; // If we need to set the status depending on the completion state // the key to it is here. gui_->set_game_mode(game_display::LINGER_SP); // this is actually for after linger mode is over -- we don't // want to stay stuck in linger state when the *next* scenario // is over. set_completion setter(gamestate_,"running"); // change the end-turn button text to its alternate label gui_->get_theme().refresh_title2("button-endturn", "title2"); gui_->invalidate_theme(); gui_->redraw_everything(); // End all unit moves for (unit_map::iterator u = units_.begin(); u != units_.end(); ++u) { u->set_user_end_turn(true); } start_pass_scenario_anim(get_end_level_data().result); try { // Same logic as single-player human turn, but // *not* the same as multiplayer human turn. gui_->enable_menu("endturn", true); while(!end_turn_) { // Reset the team number to make sure we're the right team. player_number_ = first_player_; play_slice(); gui_->draw(); } } catch(game::load_game_exception& lge) { // Loading a new game is effectively a quit. if (lge.game != "") { gamestate_ = game_state(); } throw lge; } if (gui_->pass_scenario_anim_id() != -1) { gui_->erase_screen_anim(gui_->pass_scenario_anim_id()); } // revert the end-turn button text to its normal label gui_->get_theme().refresh_title2("button-endturn", "title"); gui_->invalidate_theme(); gui_->redraw_everything(); gui_->set_game_mode(game_display::RUNNING); LOG_NG << "ending end-of-scenario linger\n"; }
void playsingle_controller::linger() { mouse_handler_.do_right_click(false); browse_ = true; linger_ = true; // If we need to set the status depending on the completion state // the key to it is here. gui_->set_game_mode(game_display::LINGER_SP); // this is actually for after linger mode is over -- we don't // want to stay stuck in linger state when the *next* scenario // is over. set_completion setter(gamestate_,"running"); // change the end-turn button text to its alternate label gui_->redraw_everything(); // button be reconstruct. if (lobby->chat.ready()) { refresh_chat_button(*gui_, "misc/network-disconnected.png"); } start_pass_scenario_anim(get_end_level_data().result); try { // Same logic as single-player human turn, but // *not* the same as multiplayer human turn. gui_->set_theme_object_active("endturn", true); while(!end_turn_) { // Reset the team number to make sure we're the right team. player_number_ = first_player_; play_slice(); gui_->draw(); } } catch(game::load_game_exception& lge) { // Loading a new game is effectively a quit. if (lge.game != "") { gamestate_ = game_state(); } throw lge; } if (gui_->pass_scenario_anim_id() != -1) { gui_->erase_area_anim(gui_->pass_scenario_anim_id()); } // revert the end-turn button text to its normal label gui_->redraw_everything(); gui_->set_game_mode(game_display::RUNNING); LOG_NG << "ending end-of-scenario linger\n"; }
void playmp_controller::linger() { mouse_handler_.do_right_click(false); browse_ = true; linger_ = true; // If we need to set the status depending on the completion state // we're needed here. gui_->set_game_mode(game_display::LINGER_MP); // this is actually for after linger mode is over -- we don't want to // stay stuck in linger state when the *next* scenario is over. gamestate_.classification().completion = "running"; //current_team().set_countdown_time(0); //halt and cancel the countdown timer reset_countdown(); set_end_scenario_button(); if ( get_end_level_data().reveal_map ) { // switch to observer viewpoint gui_->set_team(0,true); gui_->recalculate_minimap(); gui_->invalidate_all(); gui_->draw(true,true); } bool quit; start_pass_scenario_anim(get_end_level_data().result); do { quit = true; try { // reimplement parts of play_side() player_number_ = first_player_; init_turn_data(); play_human_turn(); after_human_turn(); release_turn_data(); LOG_NG << "finished human turn" << std::endl; } catch (game::load_game_exception&) { LOG_NG << "caught load-game-exception" << std::endl; // this should not happen, the option to load a game is disabled throw; } catch (end_level_exception&) { // thrown if the host ends the scenario and let us advance // to the next level LOG_NG << "caught end-level-exception" << std::endl; reset_end_scenario_button(); throw; } catch (end_turn_exception&) { // thrown if the host leaves the game (sends [leave_game]), we need // to stay in this loop to stay in linger mode, otherwise the game // gets aborted LOG_NG << "caught end-turn-exception" << std::endl; quit = false; } catch (network::error&) { LOG_NG << "caught network-error-exception" << std::endl; quit = false; } } while (!quit); if (gui_->pass_scenario_anim_id() != -1) { gui_->erase_area_anim(gui_->pass_scenario_anim_id()); } reset_end_scenario_button(); LOG_NG << "ending end-of-scenario linger\n"; }