Merge lp:~widelands-dev/widelands/bug-1714681-multiplayer-tribe-team into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8691
Proposed branch: lp:~widelands-dev/widelands/bug-1714681-multiplayer-tribe-team
Merge into: lp:widelands
Diff against target: 33 lines (+10/-6)
1 file modified
src/wui/multiplayersetupgroup.cc (+10/-6)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1714681-multiplayer-tribe-team
Reviewer Review Type Date Requested Status
Notabilis Approve
Review via email: mp+344875@code.launchpad.net

Commit message

Always update MultiPlayerPlayerGroup when a NoteGameSettings::Action::kUser notification is received

This fixes a bug where players could still edit the tribe and team for a shared slot after moving away from it

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3425. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/373389863.
Appveyor build 3230. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1714681_multiplayer_tribe_team-3230.

Revision history for this message
Notabilis (notabilis27) wrote :

Diff looks good and testing works as desired.

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks!

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/wui/multiplayersetupgroup.cc'
--- src/wui/multiplayersetupgroup.cc 2018-04-07 16:59:00 +0000
+++ src/wui/multiplayersetupgroup.cc 2018-05-01 08:06:08 +0000
@@ -227,19 +227,23 @@
227227
228 subscriber_ = Notifications::subscribe<NoteGameSettings>([this](228 subscriber_ = Notifications::subscribe<NoteGameSettings>([this](
229 const NoteGameSettings& note) {229 const NoteGameSettings& note) {
230 const std::vector<PlayerSettings>& players = settings_->settings().players;230 if (settings_->settings().players.empty()) {
231 // No map/savegame yet
232 return;
233 }
234
231 switch (note.action) {235 switch (note.action) {
232 case NoteGameSettings::Action::kMap:236 case NoteGameSettings::Action::kMap:
233 // We don't care about map updates, since we receive enough notifications for the237 // We don't care about map updates, since we receive enough notifications for the
234 // slots.238 // slots.
235 break;239 break;
240 case NoteGameSettings::Action::kUser:
241 // We might have moved away from a slot, so we need to update the previous slot too. Since we can't track the slots here, we just update everything.
242 update();
243 break;
236 default:244 default:
237 if (players.empty()) {
238 // No map/savegame yet
239 return;
240 }
241 if (id_ == note.position ||245 if (id_ == note.position ||
242 (id_ < players.size() && players.at(id_).state == PlayerSettings::State::kShared)) {246 (id_ < settings_->settings().players.size() && settings_->settings().players.at(id_).state == PlayerSettings::State::kShared)) {
243 update();247 update();
244 }248 }
245 }249 }

Subscribers

People subscribed via source and target branches

to status/vote changes: