diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-11-20 22:30:56 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-12-16 22:28:32 +0100 |
commit | e6e69d528921ab731c4c38ee708ff31b7055fd27 (patch) | |
tree | 25e19470a3b2179c7c9c9b76cdc4dc7e2906dbf4 /src/script/api/script_goal.cpp | |
parent | 1a42a8a5d50e917a3b7158feadc70205cf912cba (diff) | |
download | openttd-e6e69d528921ab731c4c38ee708ff31b7055fd27.tar.xz |
Codechange: Un-bitstuff goal and story page commands.
Diffstat (limited to 'src/script/api/script_goal.cpp')
-rw-r--r-- | src/script/api/script_goal.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/script/api/script_goal.cpp b/src/script/api/script_goal.cpp index dbc2c51e0..70f040dd4 100644 --- a/src/script/api/script_goal.cpp +++ b/src/script/api/script_goal.cpp @@ -38,7 +38,7 @@ EnforcePreconditionEncodedText(GOAL_INVALID, text); EnforcePrecondition(GOAL_INVALID, company == ScriptCompany::COMPANY_INVALID || ScriptCompany::ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID); - uint8 c = company; + CompanyID c = (::CompanyID)company; if (company == ScriptCompany::COMPANY_INVALID) c = INVALID_COMPANY; StoryPage *story_page = nullptr; if (type == GT_STORY_PAGE && ScriptStoryPage::IsValidStoryPage((ScriptStoryPage::StoryPageID)destination)) story_page = ::StoryPage::Get((ScriptStoryPage::StoryPageID)destination); @@ -50,7 +50,7 @@ (type == GT_COMPANY && ScriptCompany::ResolveCompanyID((ScriptCompany::CompanyID)destination) != ScriptCompany::COMPANY_INVALID) || (type == GT_STORY_PAGE && story_page != nullptr && (c == INVALID_COMPANY ? story_page->company == INVALID_COMPANY : story_page->company == INVALID_COMPANY || story_page->company == c))); - if (!ScriptObject::Command<CMD_CREATE_GOAL>::Do(&ScriptInstance::DoCommandReturnGoalID, 0, type | (c << 8), destination, text)) return GOAL_INVALID; + if (!ScriptObject::Command<CMD_CREATE_GOAL>::Do(&ScriptInstance::DoCommandReturnGoalID, c, (::GoalType)type, destination, text)) return GOAL_INVALID; /* In case of test-mode, we return GoalID 0 */ return (ScriptGoal::GoalID)0; @@ -61,7 +61,7 @@ EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY); EnforcePrecondition(false, IsValidGoal(goal_id)); - return ScriptObject::Command<CMD_REMOVE_GOAL>::Do(0, goal_id, 0, {}); + return ScriptObject::Command<CMD_REMOVE_GOAL>::Do(goal_id); } /* static */ bool ScriptGoal::SetText(GoalID goal_id, Text *goal) @@ -73,7 +73,7 @@ EnforcePrecondition(false, goal != nullptr); EnforcePrecondition(false, !StrEmpty(goal->GetEncodedText())); - return ScriptObject::Command<CMD_SET_GOAL_TEXT>::Do(0, goal_id, 0, goal->GetEncodedText()); + return ScriptObject::Command<CMD_SET_GOAL_TEXT>::Do(goal_id, goal->GetEncodedText()); } /* static */ bool ScriptGoal::SetProgress(GoalID goal_id, Text *progress) @@ -88,7 +88,7 @@ progress = nullptr; } - return ScriptObject::Command<CMD_SET_GOAL_PROGRESS>::Do(0, goal_id, 0, progress != nullptr ? std::string{ progress->GetEncodedText() } : std::string{}); + return ScriptObject::Command<CMD_SET_GOAL_PROGRESS>::Do(goal_id, progress != nullptr ? std::string{ progress->GetEncodedText() } : std::string{}); } /* static */ bool ScriptGoal::SetCompleted(GoalID goal_id, bool completed) @@ -96,7 +96,7 @@ EnforcePrecondition(false, IsValidGoal(goal_id)); EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY); - return ScriptObject::Command<CMD_SET_GOAL_COMPLETED>::Do(0, goal_id, completed ? 1 : 0, {}); + return ScriptObject::Command<CMD_SET_GOAL_COMPLETED>::Do(goal_id, completed); } /* static */ bool ScriptGoal::IsCompleted(GoalID goal_id) @@ -121,7 +121,7 @@ EnforcePrecondition(false, buttons < (1 << ::GOAL_QUESTION_BUTTON_COUNT)); EnforcePrecondition(false, (int)type < ::GQT_END); - return ScriptObject::Command<CMD_GOAL_QUESTION>::Do(0, uniqueid | (target << 16), buttons | (type << 29) | (is_client ? (1 << 31) : 0), text); + return ScriptObject::Command<CMD_GOAL_QUESTION>::Do(uniqueid, target, is_client, buttons, (::GoalQuestionType)type, text); } /* static */ bool ScriptGoal::Question(uint16 uniqueid, ScriptCompany::CompanyID company, Text *question, QuestionType type, int buttons) @@ -146,5 +146,5 @@ { EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY); - return ScriptObject::Command<CMD_GOAL_QUESTION_ANSWER>::Do(0, uniqueid, 0, {}); + return ScriptObject::Command<CMD_GOAL_QUESTION_ANSWER>::Do(uniqueid, 0); } |