← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1634736-victory-gamespeed into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1634736-victory-gamespeed into lp:widelands.

Commit message:
The game summary window now restores the original desired speed when it's closed.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1634736 in widelands: "Game speed won't resume after "continue playing" at victory"
  https://bugs.launchpad.net/widelands/+bug/1634736

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1634736-victory-gamespeed/+merge/316973

Resume game speed when game summary window is closed. Using the desired speed is the only way to pause the game both in single- and multiplayer mode.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1634736-victory-gamespeed into lp:widelands.
=== modified file 'src/wui/game_summary.cc'
--- src/wui/game_summary.cc	2017-01-25 18:55:59 +0000
+++ src/wui/game_summary.cc	2017-02-10 15:34:28 +0000
@@ -26,6 +26,7 @@
 #include "graphic/graphic.h"
 #include "graphic/playercolor.h"
 #include "logic/game.h"
+#include "logic/game_controller.h"
 #include "logic/player.h"
 #include "logic/playersmanager.h"
 #include "ui_basic/box.h"
@@ -40,7 +41,10 @@
 #define PADDING 4
 
 GameSummaryScreen::GameSummaryScreen(InteractiveGameBase* parent, UI::UniqueWindow::Registry* r)
-   : UI::UniqueWindow(parent, "game_summary", r, 0, 0, _("Game over")), game_(parent->game()) {
+   : UI::UniqueWindow(parent, "game_summary", r, 0, 0, _("Game over")),
+     game_(parent->game()),
+     desired_speed_(game_.game_controller()->desired_speed()) {
+	game_.game_controller()->set_desired_speed(0);
 	// Init boxes
 	UI::Box* vbox = new UI::Box(this, 0, 0, UI::Box::Vertical, 0, 0, PADDING);
 	title_area_ = new UI::Textarea(vbox, "", UI::Align::kHCenter);
@@ -207,6 +211,8 @@
 }
 
 void GameSummaryScreen::continue_clicked() {
+	// NOCOM game speed here?
+	game_.game_controller()->set_desired_speed(desired_speed_);
 	die();
 }
 

=== modified file 'src/wui/game_summary.h'
--- src/wui/game_summary.h	2017-01-25 18:55:59 +0000
+++ src/wui/game_summary.h	2017-02-10 15:34:28 +0000
@@ -47,6 +47,7 @@
 	std::string parse_player_info(std::string info);
 
 	Widelands::Game& game_;
+	uint32_t desired_speed_;
 	UI::Textarea* title_area_;
 	UI::Textarea* gametime_label_;
 	UI::Textarea* gametime_value_;

=== modified file 'src/wui/interactive_gamebase.cc'
--- src/wui/interactive_gamebase.cc	2017-01-25 18:55:59 +0000
+++ src/wui/interactive_gamebase.cc	2017-02-10 15:34:28 +0000
@@ -156,7 +156,6 @@
 }
 
 void InteractiveGameBase::show_game_summary() {
-	game().game_controller()->set_desired_speed(0);
 	if (game_summary_.window) {
 		game_summary_.window->set_visible(true);
 		game_summary_.window->think();


Follow ups