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

Method DoQuestion

src/script/api/script_goal.cpp:128–143  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

126}
127
128/* static */ bool ScriptGoal::DoQuestion(SQInteger uniqueid, uint32_t target, bool is_client, Text *question, QuestionType type, SQInteger buttons)
129{
130 ScriptObjectRef counter(question);
131
132 EnforceDeityMode(false);
133 EnforcePrecondition(false, question != nullptr);
134 EncodedString text = question->GetEncodedText();
135 EnforcePreconditionEncodedText(false, text);
136 uint min_buttons = (type == QT_QUESTION ? 1 : 0);
137 EnforcePrecondition(false, CountBits<uint64_t>(buttons) >= min_buttons && CountBits<uint64_t>(buttons) <= 3);
138 EnforcePrecondition(false, buttons >= 0 && buttons < (1 << ::GOAL_QUESTION_BUTTON_COUNT));
139 EnforcePrecondition(false, (int)type < ::GQT_END);
140 EnforcePrecondition(false, uniqueid >= 0 && uniqueid <= UINT16_MAX);
141
142 return ScriptObject::Command<CMD_GOAL_QUESTION>::Do(uniqueid, target, is_client, buttons, (::GoalQuestionType)type, text);
143}
144
145/* static */ bool ScriptGoal::Question(SQInteger uniqueid, ScriptCompany::CompanyID company, Text *question, QuestionType type, SQInteger buttons)
146{

Callers

nothing calls this directly

Calls 1

GetEncodedTextMethod · 0.80

Tested by

no test coverage detected