| 188 | } |
| 189 | |
| 190 | void DrawWidget(const Rect &r, WidgetID widget) const override |
| 191 | { |
| 192 | switch (widget) { |
| 193 | case WID_AIC_LIST: { |
| 194 | Rect tr = r.Shrink(WidgetDimensions::scaled.matrix); |
| 195 | int max_slot = GetGameSettings().difficulty.max_no_competitors; |
| 196 | if (_game_mode == GM_NORMAL) { |
| 197 | for (const Company *c : Company::Iterate()) { |
| 198 | if (c->is_ai) max_slot--; |
| 199 | } |
| 200 | for (CompanyID cid = CompanyID::Begin(); cid < max_slot && cid < MAX_COMPANIES; ++cid) { |
| 201 | if (Company::IsValidID(cid)) max_slot++; |
| 202 | } |
| 203 | } else { |
| 204 | max_slot++; // Slot 0 is human |
| 205 | } |
| 206 | for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < MAX_COMPANIES; i++) { |
| 207 | CompanyID cid = static_cast<CompanyID>(i); |
| 208 | DrawString(tr, this->GetSlotText(cid), this->GetSlotColour(cid, static_cast<CompanyID>(max_slot))); |
| 209 | tr.top += this->line_height; |
| 210 | } |
| 211 | break; |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override |
| 217 | { |
nothing calls this directly
no test coverage detected