summaryrefslogtreecommitdiff
path: root/src/script/api
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-11-06 23:11:22 +0100
committerMichael Lutz <michi@icosahedron.de>2021-12-16 22:28:32 +0100
commitb0990fcff7358e839468e5cf811ffddc8b9d73e2 (patch)
tree08da5cbe48d5dcc46e8c539e0da1aa8f6233bad9 /src/script/api
parent4fc055d6e97e76faf53ff3f29e36a4a4549bf6e7 (diff)
downloadopenttd-b0990fcff7358e839468e5cf811ffddc8b9d73e2.tar.xz
Codechange: Make TileIndex a "strong" typedef to give it a distinct type.
This is accomplished by changing it to a single member struct with the appropriate operator overloads to make it all work with not too much source modifications.
Diffstat (limited to 'src/script/api')
-rw-r--r--src/script/api/script_company.cpp2
-rw-r--r--src/script/api/script_types.hpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/script/api/script_company.cpp b/src/script/api/script_company.cpp
index dddcc950c..876ad84c5 100644
--- a/src/script/api/script_company.cpp
+++ b/src/script/api/script_company.cpp
@@ -238,7 +238,7 @@
EnforcePrecondition(false, company != COMPANY_INVALID);
/* Network commands only allow 0 to indicate invalid tiles, not INVALID_TILE */
- return ScriptObject::DoCommand(tile == INVALID_TILE ? 0 : tile , (uint32)(delta), company | expenses_type << 8 , CMD_CHANGE_BANK_BALANCE);
+ return ScriptObject::DoCommand(tile == INVALID_TILE ? (TileIndex)0U : tile , (uint32)(delta), company | expenses_type << 8 , CMD_CHANGE_BANK_BALANCE);
}
/* static */ bool ScriptCompany::BuildCompanyHQ(TileIndex tile)
diff --git a/src/script/api/script_types.hpp b/src/script/api/script_types.hpp
index 0d652a2d2..a570aabf7 100644
--- a/src/script/api/script_types.hpp
+++ b/src/script/api/script_types.hpp
@@ -82,6 +82,7 @@
#include "../../core/overflowsafe_type.hpp"
#include "../../company_type.h"
+#include "../../tile_type.h"
#include <squirrel.h>
/* Define all types here, so we don't have to include the whole _type.h maze */
@@ -100,7 +101,6 @@ typedef uint32 StringID; ///< The ID of a string.
typedef uint16 SubsidyID; ///< The ID of a subsidy.
typedef uint16 StoryPageID; ///< The ID of a story page.
typedef uint16 StoryPageElementID; ///< The ID of a story page element.
-typedef uint32 TileIndex; ///< The ID of a tile (just named differently).
typedef uint16 TownID; ///< The ID of a town.
typedef uint32 VehicleID; ///< The ID of a vehicle.