| 79 | } |
| 80 | |
| 81 | void HandleClick(const Subsidy *s) |
| 82 | { |
| 83 | /* determine src coordinate for subsidy and try to scroll to it */ |
| 84 | TileIndex xy; |
| 85 | switch (s->src.type) { |
| 86 | case SourceType::Industry: xy = Industry::Get(s->src.ToIndustryID())->location.tile; break; |
| 87 | case SourceType::Town: xy = Town::Get(s->src.ToTownID())->xy; break; |
| 88 | default: NOT_REACHED(); |
| 89 | } |
| 90 | |
| 91 | if (_ctrl_pressed || !ScrollMainWindowToTile(xy)) { |
| 92 | if (_ctrl_pressed) ShowExtraViewportWindow(xy); |
| 93 | |
| 94 | /* otherwise determine dst coordinate for subsidy and scroll to it */ |
| 95 | switch (s->dst.type) { |
| 96 | case SourceType::Industry: xy = Industry::Get(s->dst.ToIndustryID())->location.tile; break; |
| 97 | case SourceType::Town: xy = Town::Get(s->dst.ToTownID())->xy; break; |
| 98 | default: NOT_REACHED(); |
| 99 | } |
| 100 | |
| 101 | if (_ctrl_pressed) { |
| 102 | ShowExtraViewportWindow(xy); |
| 103 | } else { |
| 104 | ScrollMainWindowToTile(xy); |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Count the number of lines in this window. |
no test coverage detected