MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GoalQuestionWindow

Method GoalQuestionWindow

src/goal_gui.cpp:325–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323 TextColour colour{}; ///< Colour of the question text.
324
325 GoalQuestionWindow(WindowDesc &desc, WindowNumber window_number, TextColour colour, uint32_t button_mask, const EncodedString &question) : Window(desc), colour(colour)
326 {
327 this->question = question;
328
329 /* Figure out which buttons we have to enable. */
330 int n = 0;
331 for (uint bit : SetBitIterator(button_mask)) {
332 if (bit >= GOAL_QUESTION_BUTTON_COUNT) break;
333 this->button[n++] = bit;
334 if (n == 3) break;
335 }
336 this->buttons = n;
337 assert(this->buttons < 4);
338
339 this->CreateNestedTree();
340 if (this->buttons == 0) {
341 this->GetWidget<NWidgetStacked>(WID_GQ_BUTTONS)->SetDisplayedPlane(SZSP_HORIZONTAL);
342 } else {
343 this->GetWidget<NWidgetStacked>(WID_GQ_BUTTONS)->SetDisplayedPlane(this->buttons - 1);
344 }
345 this->FinishInitNested(window_number);
346 }
347
348
349 std::string GetWidgetString(WidgetID widget, StringID stringid) const override

Callers

nothing calls this directly

Calls 4

SetBitIteratorClass · 0.85
CreateNestedTreeMethod · 0.80
SetDisplayedPlaneMethod · 0.80
FinishInitNestedMethod · 0.80

Tested by

no test coverage detected