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

Method New

src/script/api/script_story_page.cpp:46–60  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

44}
45
46/* static */ StoryPageID ScriptStoryPage::New(ScriptCompany::CompanyID company, Text *title)
47{
48 ScriptObjectRef counter(title);
49
50 EnforceDeityMode(STORY_PAGE_INVALID);
51 EnforcePrecondition(STORY_PAGE_INVALID, company == ScriptCompany::COMPANY_INVALID || ScriptCompany::ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID);
52
53 ::CompanyID c = ScriptCompany::FromScriptCompanyID(company);
54
55 if (!ScriptObject::Command<CMD_CREATE_STORY_PAGE>::Do(&ScriptInstance::DoCommandReturnStoryPageID,
56 c, title != nullptr ? title->GetEncodedText() : EncodedString{})) return STORY_PAGE_INVALID;
57
58 /* In case of test-mode, we return StoryPageID 0 */
59 return StoryPageID::Begin();
60}
61
62/* static */ StoryPageElementID ScriptStoryPage::NewElement(StoryPageID story_page_id, StoryPageElementType type, SQInteger reference, Text *text)
63{

Callers

nothing calls this directly

Calls 2

BeginFunction · 0.85
GetEncodedTextMethod · 0.80

Tested by

no test coverage detected