← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1800364-reset-economy-counter into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1800364-reset-economy-counter into lp:widelands.

Commit message:
Reset economy serial in Game constructor

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1800364 in widelands: "Replay desyncs"
  https://bugs.launchpad.net/widelands/+bug/1800364

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1800364-reset-economy-counter/+merge/362938

This should fix some desyncs
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1800364-reset-economy-counter into lp:widelands.
=== modified file 'src/economy/economy.cc'
--- src/economy/economy.cc	2018-12-13 07:24:01 +0000
+++ src/economy/economy.cc	2019-02-09 08:50:46 +0000
@@ -43,6 +43,11 @@
 
 Serial Economy::last_economy_serial_ = 0;
 
+void Economy::initialize_serial() {
+	log("Initializing economy serial\n");
+	last_economy_serial_ = 0;
+}
+
 Economy::Economy(Player& player) : Economy(player, last_economy_serial_++) {
 }
 

=== modified file 'src/economy/economy.h'
--- src/economy/economy.h	2018-12-13 07:24:01 +0000
+++ src/economy/economy.h	2019-02-09 08:50:46 +0000
@@ -91,6 +91,9 @@
 public:
 	friend class EconomyDataPacket;
 
+	// Initialize the global serial on game start
+	static void initialize_serial();
+
 	/// Configurable target quantity for the supply of a ware type in the
 	/// economy.
 	///

=== modified file 'src/logic/game.cc'
--- src/logic/game.cc	2018-12-13 07:24:01 +0000
+++ src/logic/game.cc	2019-02-09 08:50:46 +0000
@@ -134,6 +134,7 @@
      /** TRANSLATORS: Win condition for this game has not been set. */
      win_condition_displayname_(_("Not set")),
      replay_(false) {
+	Economy::initialize_serial();
 }
 
 Game::~Game() {


Follow ups