Make the diff smaller with an early return?
If (!canact) {Return;}
> Am 02.12.2017 um 12:17 schrieb GunChleoc <[email protected]>:
>
> GunChleoc has proposed merging lp:~widelands-dev/widelands/can_act into
> lp:widelands.
>
> Commit message:
> Remove buttons from economy options window for spectators.
>
> Requested reviews:
> Widelands Developers (widelands-dev)
> Related bugs:
> Bug #1735090 in widelands: "Replays crash when a training site construction
> window is open"
> https://bugs.launchpad.net/widelands/+bug/1735090
>
> For more details, see:
> https://code.launchpad.net/~widelands-dev/widelands/can_act/+merge/334633
>
> A small cosmetic change.
> --
> You are subscribed to branch lp:widelands.
> === modified file 'src/wui/economy_options_window.cc' ---
> src/wui/economy_options_window.cc 2017-11-29 21:40:56 +0000 +++
> src/wui/economy_options_window.cc 2017-12-02 11:16:37 +0000 @@ -128,31
> +128,30 @@ display_(this, 0, 0, type_, can_act_, economy) { add(&display_,
> UI::Box::Resizing::kFullSize); - UI::Box* buttons = new UI::Box(this,
> 0, 0, UI::Box::Horizontal); - add(buttons); - - UI::Button* b = -
> new UI::Button(buttons, "decrease_target", 0, 0, 34, 34, -
> g_gr->images().get("images/ui_basic/but4.png"), "-", _("Decrease target")); -
> b->set_enabled(can_act_); -
> b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this,
> -1)); - buttons->add(b); - b->set_repeating(true); -
> buttons->add_space(8); - - b = new UI::Button(buttons,
> "increase_target", 0, 0, 34, 34, -
> g_gr->images().get("images/ui_basic/but4.png"), "+", _("Increase target")); -
> b->set_enabled(can_act_); -
> b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this,
> 1)); - buttons->add(b); - b->set_repeating(true); -
> buttons->add_space(8); - - b = new UI::Button(buttons, "reset_target",
> 0, 0, 34, 34, - g_gr->images().get("images/ui_basic/but4.png"), "R",
> _("Reset to default")); - b->set_enabled(can_act_); -
> b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::reset_target, this));
> - buttons->add(b); + if (can_act_) { + UI::Box* buttons = new
> UI::Box(this, 0, 0, UI::Box::Horizontal); + add(buttons); + +
> UI::Button* b = + new UI::Button(buttons, "decrease_target", 0, 0, 34,
> 34, + g_gr->images().get("images/ui_basic/but4.png"), "-", _("Decrease
> target")); +
> b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this,
> -1)); + buttons->add(b); + b->set_repeating(true); +
> buttons->add_space(8); + + b = new UI::Button(buttons,
> "increase_target", 0, 0, 34, 34, +
> g_gr->images().get("images/ui_basic/but4.png"), "+", _("Increase target")); +
> b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target,
> this, 1)); + buttons->add(b); + b->set_repeating(true); +
> buttons->add_space(8); + + b = new UI::Button(buttons, "reset_target",
> 0, 0, 34, 34, + g_gr->images().get("images/ui_basic/but4.png"), "R",
> _("Reset to default")); +
> b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::reset_target, this));
> + buttons->add(b); + } } void
> EconomyOptionsWindow::EconomyOptionsPanel::set_economy(Widelands::Economy*
> economy) {
--
https://code.launchpad.net/~widelands-dev/widelands/can_act/+merge/334633
Your team Widelands Developers is requested to review the proposed merge of
lp:~widelands-dev/widelands/can_act into lp:widelands.
_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~widelands-dev
More help : https://help.launchpad.net/ListHelp