equal
deleted
inserted
replaced
434 } |
434 } |
435 } |
435 } |
436 |
436 |
437 virtual void OnClick(Point pt, int widget) |
437 virtual void OnClick(Point pt, int widget) |
438 { |
438 { |
439 PlayerID owner = (PlayerID)this->window_number; |
|
440 |
|
441 switch (widget) { |
439 switch (widget) { |
442 case SLW_LIST: { |
440 case SLW_LIST: { |
443 uint32 id_v = (pt.y - 41) / 10; |
441 uint32 id_v = (pt.y - 41) / 10; |
444 |
442 |
445 if (id_v >= this->vscroll.cap) return; // click out of bounds |
443 if (id_v >= this->vscroll.cap) return; // click out of bounds |
448 |
446 |
449 if (id_v >= this->list_length) return; // click out of list bound |
447 if (id_v >= this->list_length) return; // click out of list bound |
450 |
448 |
451 const Station *st = this->sort_list[id_v]; |
449 const Station *st = this->sort_list[id_v]; |
452 /* do not check HasStationInUse - it is slow and may be invalid */ |
450 /* do not check HasStationInUse - it is slow and may be invalid */ |
453 assert(st->owner == owner || (st->owner == OWNER_NONE && !st->IsBuoy())); |
451 assert(st->owner == (PlayerID)this->window_number || (st->owner == OWNER_NONE && !st->IsBuoy())); |
454 |
452 |
455 if (_ctrl_pressed) { |
453 if (_ctrl_pressed) { |
456 ShowExtraViewPortWindow(st->xy); |
454 ShowExtraViewPortWindow(st->xy); |
457 } else { |
455 } else { |
458 ScrollMainWindowToTile(st->xy); |
456 ScrollMainWindowToTile(st->xy); |