summaryrefslogtreecommitdiff
path: root/src/tree_cmd.cpp
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/tree_cmd.cpp
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/tree_cmd.cpp')
-rw-r--r--src/tree_cmd.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index a16ad7b82..ab439cd58 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -399,7 +399,7 @@ CommandCost CmdPlantTree(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32
Company *c = (_game_mode != GM_EDITOR) ? Company::GetIfValid(_current_company) : nullptr;
int limit = (c == nullptr ? INT32_MAX : GB(c->tree_limit, 16, 16));
- TileArea ta(tile, p2);
+ TileArea ta(tile, (TileIndex)p2);
for (TileIndex current_tile : ta) {
switch (GetTileType(current_tile)) {
case MP_TREES:
@@ -528,7 +528,7 @@ static void DrawTile_Trees(TileInfo *ti)
/* Do not draw trees when the invisible trees setting is set */
if (IsInvisibilitySet(TO_TREES)) return;
- uint tmp = CountBits(ti->tile + ti->x + ti->y);
+ uint tmp = CountBits(static_cast<uint32>(ti->tile + ti->x + ti->y));
uint index = GB(tmp, 0, 2) + (GetTreeType(ti->tile) << 2);
/* different tree styles above one of the grounds */