summaryrefslogtreecommitdiff
path: root/src/tree_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-01-10 18:56:51 +0000
committerrubidium <rubidium@openttd.org>2007-01-10 18:56:51 +0000
commita7d0cdf95fd8847ab76b35446e1c9b77f8ef1cb7 (patch)
tree1a1c59c13ddb1d152052f3a3a0bcffe4fb531173 /src/tree_cmd.cpp
parentce75f6549dd379b506c9f1e9383bd881aa7cf5c7 (diff)
downloadopenttd-a7d0cdf95fd8847ab76b35446e1c9b77f8ef1cb7.tar.xz
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
Diffstat (limited to 'src/tree_cmd.cpp')
-rw-r--r--src/tree_cmd.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index 47b9a4a37..eddd9c082 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -28,20 +28,20 @@ static TreeType GetRandomTreeType(TileIndex tile, uint seed)
{
switch (_opt.landscape) {
case LT_NORMAL:
- return seed * TREE_COUNT_TEMPERATE / 256 + TREE_TEMPERATE;
+ return (TreeType)(seed * TREE_COUNT_TEMPERATE / 256 + TREE_TEMPERATE);
case LT_HILLY:
- return seed * TREE_COUNT_SUB_ARCTIC / 256 + TREE_SUB_ARCTIC;
+ return (TreeType)(seed * TREE_COUNT_SUB_ARCTIC / 256 + TREE_SUB_ARCTIC);
case LT_DESERT:
switch (GetTropicZone(tile)) {
- case TROPICZONE_INVALID: return seed * TREE_COUNT_SUB_TROPICAL / 256 + TREE_SUB_TROPICAL;
- case TROPICZONE_DESERT: return (seed > 12) ? TREE_INVALID : TREE_CACTUS;
- default: return seed * TREE_COUNT_RAINFOREST / 256 + TREE_RAINFOREST;
+ case TROPICZONE_INVALID: return (TreeType)(seed * TREE_COUNT_SUB_TROPICAL / 256 + TREE_SUB_TROPICAL);
+ case TROPICZONE_DESERT: return (TreeType)((seed > 12) ? TREE_INVALID : TREE_CACTUS);
+ default: return (TreeType)(seed * TREE_COUNT_RAINFOREST / 256 + TREE_RAINFOREST);
}
default:
- return seed * TREE_COUNT_TOYLAND / 256 + TREE_TOYLAND;
+ return (TreeType)(seed * TREE_COUNT_TOYLAND / 256 + TREE_TOYLAND);
}
}
@@ -55,10 +55,10 @@ static void PlaceTree(TileIndex tile, uint32 r)
// above snowline?
if (_opt.landscape == LT_HILLY && GetTileZ(tile) > _opt.snow_line) {
SetTreeGroundDensity(tile, TREE_GROUND_SNOW_DESERT, 3);
- SetTreeCounter(tile, GB(r, 24, 3));
+ SetTreeCounter(tile, (TreeGround)GB(r, 24, 3));
} else {
- SetTreeGroundDensity(tile, GB(r, 28, 1), 0);
- SetTreeCounter(tile, GB(r, 24, 4));
+ SetTreeGroundDensity(tile, (TreeGround)GB(r, 28, 1), 0);
+ SetTreeCounter(tile, (TreeGround)GB(r, 24, 4));
}
}
}
@@ -116,7 +116,7 @@ void PlaceTreeAtSameHeight(TileIndex tile, uint height)
continue;
/* Not too much height difference */
- if (myabs(GetTileZ(cur_tile) - height) > 2) continue;
+ if (delta(GetTileZ(cur_tile), height) > 2) continue;
/* Place one tree and quit */
PlaceTree(cur_tile, r);
@@ -278,7 +278,7 @@ int32 CmdPlantTree(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
ChangeTownRating(t, RATING_TREE_UP_STEP, RATING_TREE_MAXIMUM);
}
- treetype = p1;
+ treetype = (TreeType)p1;
if (treetype == TREE_INVALID) {
treetype = GetRandomTreeType(tile, GB(Random(), 24, 8));
if (treetype == TREE_INVALID) treetype = TREE_CACTUS;
@@ -408,7 +408,7 @@ static void DrawTile_Trees(TileInfo *ti)
static uint GetSlopeZ_Trees(TileIndex tile, uint x, uint y)
{
uint z;
- uint tileh = GetTileSlope(tile, &z);
+ Slope tileh = GetTileSlope(tile, &z);
return z + GetPartialZ(x & 0xF, y & 0xF, tileh);
}
@@ -654,7 +654,7 @@ void InitializeTrees(void)
}
-const TileTypeProcs _tile_type_trees_procs = {
+extern const TileTypeProcs _tile_type_trees_procs = {
DrawTile_Trees, /* draw_tile_proc */
GetSlopeZ_Trees, /* get_slope_z_proc */
ClearTile_Trees, /* clear_tile_proc */