summaryrefslogtreecommitdiff
path: root/src/script/api/script_story_page.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-11-20 22:30:56 +0100
committerMichael Lutz <michi@icosahedron.de>2021-12-16 22:28:32 +0100
commite6e69d528921ab731c4c38ee708ff31b7055fd27 (patch)
tree25e19470a3b2179c7c9c9b76cdc4dc7e2906dbf4 /src/script/api/script_story_page.cpp
parent1a42a8a5d50e917a3b7158feadc70205cf912cba (diff)
downloadopenttd-e6e69d528921ab731c4c38ee708ff31b7055fd27.tar.xz
Codechange: Un-bitstuff goal and story page commands.
Diffstat (limited to 'src/script/api/script_story_page.cpp')
-rw-r--r--src/script/api/script_story_page.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/script/api/script_story_page.cpp b/src/script/api/script_story_page.cpp
index afa259041..f767472e0 100644
--- a/src/script/api/script_story_page.cpp
+++ b/src/script/api/script_story_page.cpp
@@ -49,10 +49,7 @@ static inline bool StoryPageElementTypeRequiresText(StoryPageElementType type)
if (company == ScriptCompany::COMPANY_INVALID) c = INVALID_COMPANY;
if (!ScriptObject::Command<CMD_CREATE_STORY_PAGE>::Do(&ScriptInstance::DoCommandReturnStoryPageID,
- 0,
- c,
- 0,
- title != nullptr ? std::string{ title->GetEncodedText() } : std::string{})) return STORY_PAGE_INVALID;
+ (::CompanyID)c, title != nullptr ? std::string{ title->GetEncodedText() } : std::string{})) return STORY_PAGE_INVALID;
/* In case of test-mode, we return StoryPageID 0 */
return (ScriptStoryPage::StoryPageID)0;
@@ -91,7 +88,7 @@ static inline bool StoryPageElementTypeRequiresText(StoryPageElementType type)
if (!ScriptObject::Command<CMD_CREATE_STORY_PAGE_ELEMENT>::Do(&ScriptInstance::DoCommandReturnStoryPageElementID,
reftile,
- story_page_id + (type << 16),
+ (::StoryPageID)story_page_id, (::StoryPageElementType)type,
refid,
StoryPageElementTypeRequiresText(btype) ? std::string{ text->GetEncodedText() } : std::string{})) return STORY_PAGE_ELEMENT_INVALID;
@@ -160,7 +157,7 @@ static inline bool StoryPageElementTypeRequiresText(StoryPageElementType type)
EnforcePrecondition(false, IsValidStoryPage(story_page_id));
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
- return ScriptObject::Command<CMD_SET_STORY_PAGE_TITLE>::Do(0, story_page_id, 0, title != nullptr ? std::string{ title->GetEncodedText() } : std::string{});
+ return ScriptObject::Command<CMD_SET_STORY_PAGE_TITLE>::Do(story_page_id, title != nullptr ? std::string{ title->GetEncodedText() } : std::string{});
}
/* static */ ScriptCompany::CompanyID ScriptStoryPage::GetCompany(StoryPageID story_page_id)
@@ -186,7 +183,7 @@ static inline bool StoryPageElementTypeRequiresText(StoryPageElementType type)
EnforcePrecondition(false, IsValidStoryPage(story_page_id));
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
- return ScriptObject::Command<CMD_SET_STORY_PAGE_DATE>::Do(0, story_page_id, date, {});
+ return ScriptObject::Command<CMD_SET_STORY_PAGE_DATE>::Do(story_page_id, date);
}
@@ -195,7 +192,7 @@ static inline bool StoryPageElementTypeRequiresText(StoryPageElementType type)
EnforcePrecondition(false, IsValidStoryPage(story_page_id));
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
- return ScriptObject::Command<CMD_SHOW_STORY_PAGE>::Do(0, story_page_id, 0, {});
+ return ScriptObject::Command<CMD_SHOW_STORY_PAGE>::Do(story_page_id);
}
/* static */ bool ScriptStoryPage::Remove(StoryPageID story_page_id)
@@ -203,7 +200,7 @@ static inline bool StoryPageElementTypeRequiresText(StoryPageElementType type)
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
EnforcePrecondition(false, IsValidStoryPage(story_page_id));
- return ScriptObject::Command<CMD_REMOVE_STORY_PAGE>::Do(0, story_page_id, 0, {});
+ return ScriptObject::Command<CMD_REMOVE_STORY_PAGE>::Do(story_page_id);
}
/* static */ bool ScriptStoryPage::RemoveElement(StoryPageElementID story_page_element_id)
@@ -211,7 +208,7 @@ static inline bool StoryPageElementTypeRequiresText(StoryPageElementType type)
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
EnforcePrecondition(false, IsValidStoryPageElement(story_page_element_id));
- return ScriptObject::Command<CMD_REMOVE_STORY_PAGE_ELEMENT>::Do(0, story_page_element_id, 0, {});
+ return ScriptObject::Command<CMD_REMOVE_STORY_PAGE_ELEMENT>::Do(story_page_element_id);
}
/* static */ ScriptStoryPage::StoryPageButtonFormatting ScriptStoryPage::MakePushButtonReference(StoryPageButtonColour colour, StoryPageButtonFlags flags)