diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-11-21 23:03:44 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-12-16 22:28:32 +0100 |
commit | 58cff7b081ce9ea4b5314cf8324ca60607389d15 (patch) | |
tree | 0d46a0522d5fbbb1039e1e31e07557ee1ad9befb /src/script/api | |
parent | c6d7b98808575f31103121528565ed252a3cfc6c (diff) | |
download | openttd-58cff7b081ce9ea4b5314cf8324ca60607389d15.tar.xz |
Codechange: Un-bitstuff the remaining on-map commands.
Diffstat (limited to 'src/script/api')
-rw-r--r-- | src/script/api/script_company.cpp | 2 | ||||
-rw-r--r-- | src/script/api/script_industry.cpp | 8 | ||||
-rw-r--r-- | src/script/api/script_industrytype.cpp | 4 | ||||
-rw-r--r-- | src/script/api/script_objecttype.cpp | 2 | ||||
-rw-r--r-- | src/script/api/script_sign.cpp | 6 | ||||
-rw-r--r-- | src/script/api/script_tile.cpp | 4 | ||||
-rw-r--r-- | src/script/api/script_viewport.cpp | 6 |
7 files changed, 16 insertions, 16 deletions
diff --git a/src/script/api/script_company.cpp b/src/script/api/script_company.cpp index c8f8a616f..1cc69bc93 100644 --- a/src/script/api/script_company.cpp +++ b/src/script/api/script_company.cpp @@ -252,7 +252,7 @@ EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY); EnforcePrecondition(false, ::IsValidTile(tile)); - return ScriptObject::Command<CMD_BUILD_OBJECT>::Do(tile, OBJECT_HQ, 0, {}); + return ScriptObject::Command<CMD_BUILD_OBJECT>::Do(tile, OBJECT_HQ, 0); } /* static */ TileIndex ScriptCompany::GetCompanyHQ(CompanyID company) diff --git a/src/script/api/script_industry.cpp b/src/script/api/script_industry.cpp index afcaee554..ca0eaafc4 100644 --- a/src/script/api/script_industry.cpp +++ b/src/script/api/script_industry.cpp @@ -60,7 +60,7 @@ } EnforcePrecondition(false, IsValidIndustry(industry_id)); - return ScriptObject::Command<CMD_INDUSTRY_CTRL>::Do(0, industry_id, static_cast<uint32>(IndustryAction::SetText), std::string{ encoded_text ? encoded_text : "" }); + return ScriptObject::Command<CMD_INDUSTRY_CTRL>::Do(industry_id, IndustryAction::SetText, INDCTL_NONE, INVALID_OWNER, std::string{ encoded_text ? encoded_text : "" }); } /* static */ ScriptIndustry::CargoAcceptState ScriptIndustry::IsCargoAccepted(IndustryID industry_id, CargoID cargo_id) @@ -258,7 +258,7 @@ bool ScriptIndustry::SetControlFlags(IndustryID industry_id, uint32 control_flag if (ScriptObject::GetCompany() != OWNER_DEITY) return false; if (!IsValidIndustry(industry_id)) return false; - return ScriptObject::Command<CMD_INDUSTRY_CTRL>::Do(0, industry_id, 0 | ((control_flags & ::INDCTL_MASK) << 8), {}); + return ScriptObject::Command<CMD_INDUSTRY_CTRL>::Do(industry_id, IndustryAction::SetControlFlags, (::IndustryControlFlags)control_flags & ::INDCTL_MASK, INVALID_OWNER, {}); } /* static */ ScriptCompany::CompanyID ScriptIndustry::GetExclusiveSupplier(IndustryID industry_id) @@ -277,7 +277,7 @@ bool ScriptIndustry::SetControlFlags(IndustryID industry_id, uint32 control_flag auto company = ScriptCompany::ResolveCompanyID(company_id); ::Owner owner = (company == ScriptCompany::COMPANY_INVALID ? ::INVALID_OWNER : (::Owner)company); - return ScriptObject::Command<CMD_INDUSTRY_CTRL>::Do(0, industry_id, 1 | (((uint8)owner) << 16), {}); + return ScriptObject::Command<CMD_INDUSTRY_CTRL>::Do(industry_id, IndustryAction::SetExclusiveSupplier, INDCTL_NONE, owner, {}); } /* static */ ScriptCompany::CompanyID ScriptIndustry::GetExclusiveConsumer(IndustryID industry_id) @@ -296,5 +296,5 @@ bool ScriptIndustry::SetControlFlags(IndustryID industry_id, uint32 control_flag auto company = ScriptCompany::ResolveCompanyID(company_id); ::Owner owner = (company == ScriptCompany::COMPANY_INVALID ? ::INVALID_OWNER : (::Owner)company); - return ScriptObject::Command<CMD_INDUSTRY_CTRL>::Do(0, industry_id, 2 | (((uint8)owner) << 16), {}); + return ScriptObject::Command<CMD_INDUSTRY_CTRL>::Do(industry_id, IndustryAction::SetExclusiveConsumer, INDCTL_NONE, owner, {}); } diff --git a/src/script/api/script_industrytype.cpp b/src/script/api/script_industrytype.cpp index ebe28c406..ce8d63e51 100644 --- a/src/script/api/script_industrytype.cpp +++ b/src/script/api/script_industrytype.cpp @@ -123,7 +123,7 @@ uint32 seed = ::InteractiveRandom(); uint32 layout_index = ::InteractiveRandomRange((uint32)::GetIndustrySpec(industry_type)->layouts.size()); - return ScriptObject::Command<CMD_BUILD_INDUSTRY>::Do(tile, (1 << 16) | (layout_index << 8) | industry_type, seed, {}); + return ScriptObject::Command<CMD_BUILD_INDUSTRY>::Do(tile, industry_type, layout_index, true, seed); } /* static */ bool ScriptIndustryType::ProspectIndustry(IndustryType industry_type) @@ -131,7 +131,7 @@ EnforcePrecondition(false, CanProspectIndustry(industry_type)); uint32 seed = ::InteractiveRandom(); - return ScriptObject::Command<CMD_BUILD_INDUSTRY>::Do(0, industry_type, seed, {}); + return ScriptObject::Command<CMD_BUILD_INDUSTRY>::Do(0, industry_type, 0, false, seed); } /* static */ bool ScriptIndustryType::IsBuiltOnWater(IndustryType industry_type) diff --git a/src/script/api/script_objecttype.cpp b/src/script/api/script_objecttype.cpp index a4a8ef984..cd97761de 100644 --- a/src/script/api/script_objecttype.cpp +++ b/src/script/api/script_objecttype.cpp @@ -42,5 +42,5 @@ EnforcePrecondition(false, IsValidObjectType(object_type)); EnforcePrecondition(false, ScriptMap::IsValidTile(tile)); - return ScriptObject::Command<CMD_BUILD_OBJECT>::Do(tile, object_type, view, {}); + return ScriptObject::Command<CMD_BUILD_OBJECT>::Do(tile, object_type, view); } diff --git a/src/script/api/script_sign.cpp b/src/script/api/script_sign.cpp index 6062497f0..c95093a79 100644 --- a/src/script/api/script_sign.cpp +++ b/src/script/api/script_sign.cpp @@ -42,7 +42,7 @@ EnforcePreconditionEncodedText(false, text); EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_SIGN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG); - return ScriptObject::Command<CMD_RENAME_SIGN>::Do(0, sign_id, 0, text); + return ScriptObject::Command<CMD_RENAME_SIGN>::Do(sign_id, text); } /* static */ char *ScriptSign::GetName(SignID sign_id) @@ -64,7 +64,7 @@ /* static */ bool ScriptSign::RemoveSign(SignID sign_id) { EnforcePrecondition(false, IsValidSign(sign_id)); - return ScriptObject::Command<CMD_RENAME_SIGN>::Do(0, sign_id, 0, ""); + return ScriptObject::Command<CMD_RENAME_SIGN>::Do(sign_id, ""); } /* static */ SignID ScriptSign::BuildSign(TileIndex location, Text *name) @@ -77,7 +77,7 @@ EnforcePreconditionEncodedText(INVALID_SIGN, text); EnforcePreconditionCustomError(INVALID_SIGN, ::Utf8StringLength(text) < MAX_LENGTH_SIGN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG); - if (!ScriptObject::Command<CMD_PLACE_SIGN>::Do(&ScriptInstance::DoCommandReturnSignID, location, 0, 0, text)) return INVALID_SIGN; + if (!ScriptObject::Command<CMD_PLACE_SIGN>::Do(&ScriptInstance::DoCommandReturnSignID, location, text)) return INVALID_SIGN; /* In case of test-mode, we return SignID 0 */ return 0; diff --git a/src/script/api/script_tile.cpp b/src/script/api/script_tile.cpp index 8be74c030..d8bcc399f 100644 --- a/src/script/api/script_tile.cpp +++ b/src/script/api/script_tile.cpp @@ -287,7 +287,7 @@ EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY); EnforcePrecondition(false, ::IsValidTile(tile)); - return ScriptObject::Command<CMD_PLANT_TREE>::Do(tile, TREE_INVALID, tile, {}); + return ScriptObject::Command<CMD_PLANT_TREE>::Do(tile, tile, TREE_INVALID); } /* static */ bool ScriptTile::PlantTreeRectangle(TileIndex tile, uint width, uint height) @@ -298,7 +298,7 @@ EnforcePrecondition(false, height >= 1 && height <= 20); TileIndex end_tile = tile + ::TileDiffXY(width - 1, height - 1); - return ScriptObject::Command<CMD_PLANT_TREE>::Do(tile, TREE_INVALID, end_tile, {}); + return ScriptObject::Command<CMD_PLANT_TREE>::Do(tile, end_tile, TREE_INVALID); } /* static */ bool ScriptTile::IsWithinTownInfluence(TileIndex tile, TownID town_id) diff --git a/src/script/api/script_viewport.cpp b/src/script/api/script_viewport.cpp index 7d57bffb3..86a4c12db 100644 --- a/src/script/api/script_viewport.cpp +++ b/src/script/api/script_viewport.cpp @@ -31,7 +31,7 @@ EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY); EnforcePrecondition(false, ScriptMap::IsValidTile(tile)); - return ScriptObject::Command<CMD_SCROLL_VIEWPORT>::Do(tile, VST_EVERYONE, 0, {}); + return ScriptObject::Command<CMD_SCROLL_VIEWPORT>::Do(tile, VST_EVERYONE, 0); } /* static */ bool ScriptViewport::ScrollCompanyClientsTo(ScriptCompany::CompanyID company, TileIndex tile) @@ -42,7 +42,7 @@ company = ScriptCompany::ResolveCompanyID(company); EnforcePrecondition(false, company != ScriptCompany::COMPANY_INVALID); - return ScriptObject::Command<CMD_SCROLL_VIEWPORT>::Do(tile, VST_COMPANY, company, {}); + return ScriptObject::Command<CMD_SCROLL_VIEWPORT>::Do(tile, VST_COMPANY, company); } /* static */ bool ScriptViewport::ScrollClientTo(ScriptClient::ClientID client, TileIndex tile) @@ -54,5 +54,5 @@ client = ScriptClient::ResolveClientID(client); EnforcePrecondition(false, client != ScriptClient::CLIENT_INVALID); - return ScriptObject::Command<CMD_SCROLL_VIEWPORT>::Do(tile, VST_CLIENT, client, {}); + return ScriptObject::Command<CMD_SCROLL_VIEWPORT>::Do(tile, VST_CLIENT, client); } |