summaryrefslogtreecommitdiff
path: root/tree_cmd.c
diff options
context:
space:
mode:
authorludde <ludde@openttd.org>2005-07-13 19:51:31 +0000
committerludde <ludde@openttd.org>2005-07-13 19:51:31 +0000
commit6013b327f7d54f9d5a331b105011c238da97046f (patch)
tree24c82eee7c186426a35f3ee245d8d753a296d7e2 /tree_cmd.c
parent4b006aa6cff4b25f6e9421d3693c2ea51e6b5220 (diff)
downloadopenttd-6013b327f7d54f9d5a331b105011c238da97046f.tar.xz
(svn r2560) Fix: various minor code changes.
Added RandomTile/RandomTileSeed functions to generate a random tile. Changed landscape routines so they don't assume that the Y map side is a power of two. (support for this is not complete, though) Changed some frequently used map macros to not compute the values each time. Silence some warnings on MSVC.
Diffstat (limited to 'tree_cmd.c')
-rw-r--r--tree_cmd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tree_cmd.c b/tree_cmd.c
index 66939a7d5..179205670 100644
--- a/tree_cmd.c
+++ b/tree_cmd.c
@@ -96,7 +96,7 @@ static void PlaceMoreTrees(void)
{
int i = ScaleByMapSize((Random() & 0x1F) + 25);
do {
- DoPlaceMoreTrees(TILE_MASK(Random()));
+ DoPlaceMoreTrees(RandomTile());
} while (--i);
}
@@ -109,7 +109,7 @@ void PlaceTreesRandomly(void)
i = ScaleByMapSize(1000);
do {
r = Random();
- tile = TILE_MASK(r);
+ tile = RandomTileSeed(r);
/* Only on clear tiles, and NOT on farm-tiles or rocks */
if (IsTileType(tile, MP_CLEAR) && (_m[tile].m5 & 0x1F) != 0x0F && (_m[tile].m5 & 0x1C) != 8) {
PlaceTree(tile, r, 0);
@@ -122,7 +122,7 @@ void PlaceTreesRandomly(void)
do {
r = Random();
- tile = TILE_MASK(r);
+ tile = RandomTileSeed(r);
if (IsTileType(tile, MP_CLEAR) && GetMapExtraBits(tile) == 2) {
PlaceTree(tile, r, 0);
}
@@ -602,7 +602,7 @@ void OnTick_Trees(void)
/* place a tree at a random rainforest spot */
if (_opt.landscape == LT_DESERT &&
- (r=Random(),tile=TILE_MASK(r),GetMapExtraBits(tile)==2) &&
+ (r=Random(),tile=RandomTileSeed(r),GetMapExtraBits(tile)==2) &&
IsTileType(tile, MP_CLEAR) &&
(m=_m[tile].m5&0x1C, m<=4) &&
(tree=GetRandomTreeType(tile, r>>24)) >= 0) {