Benedikt Straub has proposed merging lp:~widelands-dev/widelands/soldier-capacity-ctrl into lp:widelands.
Commit message: Hold down Ctrl when using the capacity arrow buttons in military- and trainingsites to set the capacity to min/max Requested reviews: Widelands Developers (widelands-dev) For more details, see: https://code.launchpad.net/~widelands-dev/widelands/soldier-capacity-ctrl/+merge/355002 -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/soldier-capacity-ctrl into lp:widelands.
=== modified file 'src/wui/soldiercapacitycontrol.cc' --- src/wui/soldiercapacitycontrol.cc 2018-04-27 06:11:05 +0000 +++ src/wui/soldiercapacitycontrol.cc 2018-09-16 09:39:05 +0000 @@ -69,7 +69,7 @@ 32, UI::ButtonStyle::kWuiMenu, g_gr->images().get("images/wui/buildings/menu_down_train.png"), - _("Decrease capacity")), + _("Decrease capacity. Hold down Ctrl to set the capacity to the lowest value")), increase_(this, "increase", 0, @@ -78,7 +78,7 @@ 32, UI::ButtonStyle::kWuiMenu, g_gr->images().get("images/wui/buildings/menu_up_train.png"), - _("Increase capacity")), + _("Increase capacity. Hold down Ctrl to set the capacity to the highest value")), value_(this, "199", UI::Align::kCenter) { decrease_.sigclicked.connect( boost::bind(&SoldierCapacityControl::click_decrease, boost::ref(*this))); @@ -112,11 +112,12 @@ } void SoldierCapacityControl::click_decrease() { - change_soldier_capacity(-1); + // using int16_t because int32_t could cause over-/underflows + change_soldier_capacity((SDL_GetModState() & KMOD_CTRL) ? std::numeric_limits<int16_t>::min() : -1); } void SoldierCapacityControl::click_increase() { - change_soldier_capacity(1); + change_soldier_capacity((SDL_GetModState() & KMOD_CTRL) ? std::numeric_limits<int16_t>::max() : 1); } UI::Panel* create_soldier_capacity_control(UI::Panel& parent,
_______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp