1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-22 11:44:17 +01:00

Codechange: use TileIndex constructor explicitly

This commit is contained in:
Rubidium
2025-01-01 09:24:26 +01:00
committed by rubidium42
parent fd5f6caed4
commit f55ba40b13
12 changed files with 57 additions and 51 deletions

View File

@@ -99,8 +99,8 @@ static void _DoCommandReturnBuildBridge1(class ScriptInstance *instance)
EnforceDeityOrCompanyModeValid(false);
/* Build the piece of road on the 'start' side of the bridge */
TileIndex end = ScriptObject::GetCallbackVariable(0);
TileIndex start = ScriptObject::GetCallbackVariable(1);
TileIndex end(ScriptObject::GetCallbackVariable(0));
TileIndex start(ScriptObject::GetCallbackVariable(1));
DiagDirection dir_1 = ::DiagdirBetweenTiles(end, start);
DiagDirection dir_2 = ::ReverseDiagDir(dir_1);
@@ -113,8 +113,8 @@ static void _DoCommandReturnBuildBridge1(class ScriptInstance *instance)
EnforceDeityOrCompanyModeValid(false);
/* Build the piece of road on the 'end' side of the bridge */
TileIndex end = ScriptObject::GetCallbackVariable(0);
TileIndex start = ScriptObject::GetCallbackVariable(1);
TileIndex end(ScriptObject::GetCallbackVariable(0));
TileIndex start(ScriptObject::GetCallbackVariable(1));
DiagDirection dir_1 = ::DiagdirBetweenTiles(end, start);
DiagDirection dir_2 = ::ReverseDiagDir(dir_1);

View File

@@ -35,7 +35,7 @@
StoryPage *story_page = nullptr;
if (type == GT_STORY_PAGE && ScriptStoryPage::IsValidStoryPage((ScriptStoryPage::StoryPageID)destination)) story_page = ::StoryPage::Get((ScriptStoryPage::StoryPageID)destination);
return (type == GT_NONE && destination == 0) ||
(type == GT_TILE && ScriptMap::IsValidTile(destination)) ||
(type == GT_TILE && ScriptMap::IsValidTile(::TileIndex(destination))) ||
(type == GT_INDUSTRY && ScriptIndustry::IsValidIndustry(destination)) ||
(type == GT_TOWN && ScriptTown::IsValidTown(destination)) ||
(type == GT_COMPANY && ScriptCompany::ResolveCompanyID((ScriptCompany::CompanyID)destination) != ScriptCompany::COMPANY_INVALID) ||

View File

@@ -31,7 +31,7 @@
EnforcePrecondition(false, type == NT_ECONOMY || type == NT_SUBSIDIES || type == NT_GENERAL);
EnforcePrecondition(false, company == ScriptCompany::COMPANY_INVALID || ScriptCompany::ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID);
EnforcePrecondition(false, (ref_type == NR_NONE) ||
(ref_type == NR_TILE && ScriptMap::IsValidTile(reference)) ||
(ref_type == NR_TILE && ScriptMap::IsValidTile(::TileIndex(reference))) ||
(ref_type == NR_STATION && ScriptStation::IsValidStation(reference)) ||
(ref_type == NR_INDUSTRY && ScriptIndustry::IsValidIndustry(reference)) ||
(ref_type == NR_TOWN && ScriptTown::IsValidTown(reference)));

View File

@@ -102,8 +102,8 @@ static void _DoCommandReturnBuildTunnel1(class ScriptInstance *instance)
EnforceDeityOrCompanyModeValid(false);
/* Build the piece of road on the 'start' side of the tunnel */
TileIndex end = ScriptObject::GetCallbackVariable(0);
TileIndex start = ScriptTunnel::GetOtherTunnelEnd(end);
TileIndex end(ScriptObject::GetCallbackVariable(0));
TileIndex start{ScriptTunnel::GetOtherTunnelEnd(end)};
DiagDirection dir_1 = ::DiagdirBetweenTiles(end, start);
DiagDirection dir_2 = ::ReverseDiagDir(dir_1);
@@ -116,8 +116,8 @@ static void _DoCommandReturnBuildTunnel1(class ScriptInstance *instance)
EnforceDeityOrCompanyModeValid(false);
/* Build the piece of road on the 'end' side of the tunnel */
TileIndex end = ScriptObject::GetCallbackVariable(0);
TileIndex start = ScriptTunnel::GetOtherTunnelEnd(end);
TileIndex end(ScriptObject::GetCallbackVariable(0));
TileIndex start{ScriptTunnel::GetOtherTunnelEnd(end)};
DiagDirection dir_1 = ::DiagdirBetweenTiles(end, start);
DiagDirection dir_2 = ::ReverseDiagDir(dir_1);