Merge lp:~widelands-dev/widelands/fix_resend_player_command_in_inputqueues into lp:widelands

Proposed by SirVer
Status: Merged
Merged at revision: 8521
Proposed branch: lp:~widelands-dev/widelands/fix_resend_player_command_in_inputqueues
Merge into: lp:widelands
Diff against target: 43 lines (+9/-5)
1 file modified
src/wui/inputqueuedisplay.cc (+9/-5)
To merge this branch: bzr merge lp:~widelands-dev/widelands/fix_resend_player_command_in_inputqueues
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+334614@code.launchpad.net

Commit message

Check if we can_act() in all InputQueues callback functions.

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

LGTM :)

@bunnybot merge

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 2908. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/310248072.
Appveyor build 2717. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_fix_resend_player_command_in_inputqueues-2717.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wui/inputqueuedisplay.cc'
2--- src/wui/inputqueuedisplay.cc 2017-05-14 04:38:39 +0000
3+++ src/wui/inputqueuedisplay.cc 2017-12-01 21:08:06 +0000
4@@ -255,8 +255,10 @@
5 * Update priority when radiogroup has changed
6 */
7 void InputQueueDisplay::radiogroup_changed(int32_t state) {
8-
9 assert(type_ == Widelands::wwWARE);
10+ if (!igb_.can_act(building_.owner().player_number())) {
11+ return;
12+ }
13
14 int32_t priority = 0;
15
16@@ -273,7 +275,6 @@
17 default:
18 return;
19 }
20-
21 igb_.game().send_player_set_ware_priority(building_, type_, index_, priority);
22 }
23
24@@ -283,14 +284,17 @@
25 */
26 void InputQueueDisplay::decrease_max_fill_clicked() {
27 assert(cache_max_fill_ > 0);
28-
29+ if (!igb_.can_act(building_.owner().player_number())) {
30+ return;
31+ }
32 igb_.game().send_player_set_input_max_fill(building_, index_, type_, cache_max_fill_ - 1);
33 }
34
35 void InputQueueDisplay::increase_max_fill_clicked() {
36-
37 assert(cache_max_fill_ < queue_->get_max_size());
38-
39+ if (!igb_.can_act(building_.owner().player_number())) {
40+ return;
41+ }
42 igb_.game().send_player_set_input_max_fill(building_, index_, type_, cache_max_fill_ + 1);
43 }
44

Subscribers

People subscribed via source and target branches

to status/vote changes: