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
1=== modified file 'src/wui/multiplayersetupgroup.cc'
2--- src/wui/multiplayersetupgroup.cc 2018-04-07 16:59:00 +0000
3+++ src/wui/multiplayersetupgroup.cc 2018-05-01 08:06:08 +0000
4@@ -227,19 +227,23 @@
5
6 subscriber_ = Notifications::subscribe<NoteGameSettings>([this](
7 const NoteGameSettings& note) {
8- const std::vector<PlayerSettings>& players = settings_->settings().players;
9+ if (settings_->settings().players.empty()) {
10+ // No map/savegame yet
11+ return;
12+ }
13+
14 switch (note.action) {
15 case NoteGameSettings::Action::kMap:
16 // We don't care about map updates, since we receive enough notifications for the
17 // slots.
18 break;
19+ case NoteGameSettings::Action::kUser:
20+ // 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.
21+ update();
22+ break;
23 default:
24- if (players.empty()) {
25- // No map/savegame yet
26- return;
27- }
28 if (id_ == note.position ||
29- (id_ < players.size() && players.at(id_).state == PlayerSettings::State::kShared)) {
30+ (id_ < settings_->settings().players.size() && settings_->settings().players.at(id_).state == PlayerSettings::State::kShared)) {
31 update();
32 }
33 }

Subscribers

People subscribed via source and target branches

to status/vote changes: