Notabilis has proposed merging lp:~widelands-dev/widelands/ctrl-priorities into
lp:widelands.
Commit message:
Updating all ware priorities of a building when CTRL is pressed while clicking.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/ctrl-priorities/+merge/335276
For me it is a relatively frequent case that I want to change all ware
priorities of a building at once, e.g., a low/high priority construction site.
Currently this means clicking on multiple little red/green dots. This branch
adds the possibility to hold the CTRL key while pressing one of the priority
buttons to set all of them at once.
CTRL since the action more or less similar to the "dismantle the building
without asking" function, kind of a strong request of some functionality.
Known bug: When a priority is CTRL-clicked for a ware that already has the
priority set, the other wares are not updated. This happens since the
Radiogroup does not relay the linked method when the value is already set.
Could be changed but I didn't wanted to do so without asking since it will also
affect other classes.
Feel free to reject this change. :-)
--
Your team Widelands Developers is requested to review the proposed merge of
lp:~widelands-dev/widelands/ctrl-priorities into lp:widelands.
=== modified file 'src/wui/inputqueuedisplay.cc'
--- src/wui/inputqueuedisplay.cc 2017-12-01 20:57:15 +0000
+++ src/wui/inputqueuedisplay.cc 2017-12-15 21:23:17 +0000
@@ -275,7 +275,25 @@
default:
return;
}
- igb_.game().send_player_set_ware_priority(building_, type_, index_, priority);
+ if (SDL_GetModState() & KMOD_CTRL) {
+ Panel *sibling = get_parent()->get_first_child();
+ assert(sibling != nullptr);
+ while (sibling != nullptr) {
+ InputQueueDisplay *display = dynamic_cast<InputQueueDisplay*>(sibling);
+ sibling = sibling->get_next_sibling();
+ if (display == nullptr) {
+ continue;
+ }
+ igb_.game().send_player_set_ware_priority(
+ display->building_, display->type_, display->index_, priority);
+ if (display != this) {
+ // TODO(Notabilis): Remove this call when send_player_set_ware_priority() calls it
+ display->priority_radiogroup_->set_state(state);
+ }
+ }
+ } else {
+ igb_.game().send_player_set_ware_priority(building_, type_, index_, priority);
+ }
}
/**
_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~widelands-dev
More help : https://help.launchpad.net/ListHelp