209
209
priority_radiogroup_->changedto.connect(
210
210
boost::bind(&InputQueueDisplay::radiogroup_changed, this, _1));
211
priority_radiogroup_->clicked.connect(boost::bind(&InputQueueDisplay::radiogroup_clicked, this));
212
213
bool const can_act = igb_.can_act(building_.owner().player_number());
279
if (SDL_GetModState() & KMOD_CTRL) {
280
update_siblings(state);
278
282
igb_.game().send_player_set_ware_priority(building_, type_, index_, priority);
285
void InputQueueDisplay::radiogroup_clicked() {
286
// Already set option has been clicked again
287
// Unimportant for this queue, but update other queues
288
if (SDL_GetModState() & KMOD_CTRL) {
289
update_siblings(priority_radiogroup_->get_state());
293
void InputQueueDisplay::update_siblings(int32_t state) {
294
// "Release" the CTRL key to avoid recursion
295
const SDL_Keymod old_modifiers = SDL_GetModState();
296
SDL_SetModState(KMOD_NONE);
298
Panel* sibling = get_parent()->get_first_child();
299
// Well, at least we should be a child of our parent
300
assert(sibling != nullptr);
302
if (sibling == this) {
303
// We already have been set
306
InputQueueDisplay* display = dynamic_cast<InputQueueDisplay*>(sibling);
307
if (display == nullptr) {
308
// Cast failed. Sibling is no InputQueueDisplay
311
if (display->priority_radiogroup_->get_state() == state) {
312
// Nothing to do for this queue
315
// Calling set_state() leads to radiogroup_changed()) getting called, which does the real
317
// TODO(Notabilis): When bug 1738485 is fixed probably replace with
318
// send_player_set_ware_priority()
319
display->priority_radiogroup_->set_state(state);
320
} while ((sibling = sibling->get_next_sibling()));
322
SDL_SetModState(old_modifiers);
282
326
* One of the buttons to increase or decrease the amount of wares
283
327
* stored here has been clicked