Merge lp:~widelands-dev/widelands/soldier-capacity-ctrl into lp:widelands

Proposed by Benedikt Straub
Status: Merged
Merged at revision: 9065
Proposed branch: lp:~widelands-dev/widelands/soldier-capacity-ctrl
Merge into: lp:widelands
Diff against target: 41 lines (+10/-4)
1 file modified
src/wui/soldiercapacitycontrol.cc (+10/-4)
To merge this branch: bzr merge lp:~widelands-dev/widelands/soldier-capacity-ctrl
Reviewer Review Type Date Requested Status
Toni Förster Approve
Review via email: mp+355002@code.launchpad.net

Commit message

Hold down Ctrl when using the capacity arrow buttons in military- and trainingsites to set the capacity to min/max

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

Continuous integration builds have changed state:

Travis build 3987. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/429190145.
Appveyor build 3785. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_soldier_capacity_ctrl-3785.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I comment with an idea.

8836. By Benedikt Straub

Calculate capacity delta directly

Revision history for this message
Benedikt Straub (nordfriese) wrote :

OK implemented it like this.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Code LGTM now, not tested.

8837. By Benedikt Straub

Merged trunk

Revision history for this message
Toni Förster (stonerl) wrote :

Tested it; and it works as advertised.

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

Thanks!

Since we're in feature freeze, merging will have to wait until after Build 20.

8838. By Benedikt Straub

Merged trunk

8839. By Toni Förster

merged trunk

8840. By Nordfriese

Merged trunk

8841. By Nordfriese

Merged trunk

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4646. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/511062400.
Appveyor build 4433. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_soldier_capacity_ctrl-4433.

8842. By Nordfriese

Merged trunk

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4673. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/516239713.
Appveyor build 4459. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_soldier_capacity_ctrl-4459.

Revision history for this message
GunChleoc (gunchleoc) wrote :

@bunnybot merge

Revision history for this message
Toni Förster (stonerl) wrote :

This doesn't work for me any more in the latest trunk...

Revision history for this message
Toni Förster (stonerl) wrote :

Forget, my last comment I was just confused. Sorry.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wui/soldiercapacitycontrol.cc'
2--- src/wui/soldiercapacitycontrol.cc 2019-02-23 11:00:49 +0000
3+++ src/wui/soldiercapacitycontrol.cc 2019-04-05 14:13:25 +0000
4@@ -69,7 +69,7 @@
5 32,
6 UI::ButtonStyle::kWuiMenu,
7 g_gr->images().get("images/wui/buildings/menu_down_train.png"),
8- _("Decrease capacity")),
9+ _("Decrease capacity. Hold down Ctrl to set the capacity to the lowest value")),
10 increase_(this,
11 "increase",
12 0,
13@@ -78,7 +78,7 @@
14 32,
15 UI::ButtonStyle::kWuiMenu,
16 g_gr->images().get("images/wui/buildings/menu_up_train.png"),
17- _("Increase capacity")),
18+ _("Increase capacity. Hold down Ctrl to set the capacity to the highest value")),
19 value_(this, "199", UI::Align::kCenter) {
20 decrease_.sigclicked.connect(
21 boost::bind(&SoldierCapacityControl::click_decrease, boost::ref(*this)));
22@@ -112,11 +112,17 @@
23 }
24
25 void SoldierCapacityControl::click_decrease() {
26- change_soldier_capacity(-1);
27+ const SoldierControl* soldiers = building_.soldier_control();
28+ assert(soldiers);
29+ change_soldier_capacity((SDL_GetModState() & KMOD_CTRL) ?
30+ soldiers->min_soldier_capacity() - soldiers->soldier_capacity() : -1);
31 }
32
33 void SoldierCapacityControl::click_increase() {
34- change_soldier_capacity(1);
35+ const SoldierControl* soldiers = building_.soldier_control();
36+ assert(soldiers);
37+ change_soldier_capacity((SDL_GetModState() & KMOD_CTRL) ?
38+ soldiers->max_soldier_capacity() - soldiers->soldier_capacity() : 1);
39 }
40
41 UI::Panel* create_soldier_capacity_control(UI::Panel& parent,

Subscribers

People subscribed via source and target branches

to status/vote changes: