tree_cmd.c
author Darkvater
Sun, 26 Mar 2006 22:55:27 +0000
changeset 3347 0ddacd451b81
parent 3271 114243e3465f
child 3379 50b253bb9819
permissions -rw-r--r--
(svn r4131) - CodeChange: Add proper semantics for StationID for such variables instead of using the general uint16-type. StationID was added for depots, waypoints and stations where necessary. We probably need to change GetDepot(), IsDepotIndex(), IsStationIndex(), GetWaypoint() and IsWaypointIndex() as well to use StationID.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     3
#include "stdafx.h"
1891
862800791170 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1784
diff changeset
     4
#include "openttd.h"
3144
33e42feae531 (svn r3763) Adapt to the new 'map accessors go in foo_map.h'-scheme
tron
parents: 3079
diff changeset
     5
#include "clear_map.h"
507
04b5403aaf6b (svn r815) Include strings.h only in the files which need it.
tron
parents: 497
diff changeset
     6
#include "table/strings.h"
2148
542ea702738c (svn r2658) -Codechange: Use MAKE_TRANSPARENT to display a transparented sprite
celestar
parents: 2118
diff changeset
     7
#include "table/sprites.h"
1784
d0698aac0c2e (svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents: 1370
diff changeset
     8
#include "table/tree_land.h"
2163
b17b313113a0 (svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents: 2153
diff changeset
     9
#include "functions.h"
679
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents: 541
diff changeset
    10
#include "map.h"
1209
2e00193652b2 (svn r1713) Split off several functions which query/set information about a single tile from map.h and put them into a seperate file tile.h
tron
parents: 1202
diff changeset
    11
#include "tile.h"
3144
33e42feae531 (svn r3763) Adapt to the new 'map accessors go in foo_map.h'-scheme
tron
parents: 3079
diff changeset
    12
#include "tree_map.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
#include "viewport.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
#include "command.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    15
#include "town.h"
337
cbe0c766c947 (svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents: 193
diff changeset
    16
#include "sound.h"
2153
ecfc674410b4 (svn r2663) Include variables.h only in these files which need it, not globally via openttd.h
tron
parents: 2148
diff changeset
    17
#include "variables.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    19
static TreeType GetRandomTreeType(TileIndex tile, uint seed)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
{
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
    21
	switch (_opt.landscape) {
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
    22
		case LT_NORMAL:
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    23
			return seed * TR_COUNT_TEMPERATE / 256 + TR_TEMPERATE;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    24
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
    25
		case LT_HILLY:
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    26
			return seed * TR_COUNT_SUB_ARCTIC / 256 + TR_SUB_ARCTIC;
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
    27
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
    28
		case LT_DESERT:
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
    29
			switch (GetMapExtraBits(tile)) {
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    30
				case 0:  return seed * TR_COUNT_SUB_TROPICAL / 256 + TR_SUB_TROPICAL;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    31
				case 1:  return (seed > 12) ? TR_INVALID : TR_CACTUS;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    32
				default: return seed * TR_COUNT_RAINFOREST / 256 + TR_RAINFOREST;
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
    33
			}
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
    34
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
    35
		default:
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    36
			return seed * TR_COUNT_TOYLAND / 256 + TR_TOYLAND;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    37
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    38
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
2958
ac0a9673b522 (svn r3520) Remove unused parameters from some functions
tron
parents: 2957
diff changeset
    40
static void PlaceTree(TileIndex tile, uint32 r)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
{
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    42
	TreeType tree = GetRandomTreeType(tile, GB(r, 24, 8));
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
    43
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    44
	if (tree != TR_INVALID) {
3079
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
    45
		MakeTree(tile, tree, GB(r, 22, 2), min(GB(r, 16, 3), 6), TR_GRASS, 0);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    46
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    47
		// above snowline?
1370
c86b2c30fd01 (svn r1874) Fix bug introduced in r1839 which placed snow covered trees below the snow line ([1121680])
tron
parents: 1286
diff changeset
    48
		if (_opt.landscape == LT_HILLY && GetTileZ(tile) > _opt.snow_line) {
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    49
			SetTreeGroundDensity(tile, TR_SNOW_DESERT, 3);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    50
			SetTreeCounter(tile, GB(r, 24, 3));
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
    51
		} else {
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    52
			SetTreeGroundDensity(tile, GB(r, 28, 1), 0);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
    53
			SetTreeCounter(tile, GB(r, 24, 4));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    54
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    56
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1902
diff changeset
    58
static void DoPlaceMoreTrees(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
{
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
    60
	uint i;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
    62
	for (i = 0; i < 1000; i++) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
		uint32 r = Random();
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
    64
		int x = GB(r, 0, 5) - 16;
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
    65
		int y = GB(r, 8, 5) - 16;
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
    66
		uint dist = myabs(x) + myabs(y);
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
    67
		TileIndex cur_tile = TILE_MASK(tile + TileDiffXY(x, y));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
2955
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
    69
		if (dist <= 13 &&
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
    70
				IsTileType(cur_tile, MP_CLEAR) &&
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
    71
				!IsClearGround(cur_tile, CL_FIELDS) &&
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
    72
				!IsClearGround(cur_tile, CL_ROCKS)) {
2958
ac0a9673b522 (svn r3520) Remove unused parameters from some functions
tron
parents: 2957
diff changeset
    73
			PlaceTree(cur_tile, r);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    74
		}
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
    75
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    76
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    77
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1059
diff changeset
    78
static void PlaceMoreTrees(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    79
{
2243
b7e58afa3616 (svn r2763) Small cleanup and improve a few comments
tron
parents: 2238
diff changeset
    80
	uint i = ScaleByMapSize(GB(Random(), 0, 5) + 25);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
	do {
2051
e369160ce2f3 (svn r2560) Fix: various minor code changes.
ludde
parents: 2049
diff changeset
    82
		DoPlaceMoreTrees(RandomTile());
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    83
	} while (--i);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    84
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    85
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1059
diff changeset
    86
void PlaceTreesRandomly(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    87
{
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
    88
	uint i;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    89
1202
4d2a20c50760 (svn r1706) Implement ScaleByMapSize() and ScaleByMapSize1D()
tron
parents: 1093
diff changeset
    90
	i = ScaleByMapSize(1000);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    91
	do {
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
    92
		uint32 r = Random();
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
    93
		TileIndex tile = RandomTileSeed(r);
2955
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
    94
		if (IsTileType(tile, MP_CLEAR) &&
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
    95
				!IsClearGround(tile, CL_FIELDS) &&
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
    96
				!IsClearGround(tile, CL_ROCKS)) {
2958
ac0a9673b522 (svn r3520) Remove unused parameters from some functions
tron
parents: 2957
diff changeset
    97
			PlaceTree(tile, r);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    98
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    99
	} while (--i);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   100
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   101
	/* place extra trees at rainforest area */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   102
	if (_opt.landscape == LT_DESERT) {
1202
4d2a20c50760 (svn r1706) Implement ScaleByMapSize() and ScaleByMapSize1D()
tron
parents: 1093
diff changeset
   103
		i = ScaleByMapSize(15000);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   104
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   105
		do {
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   106
			uint32 r = Random();
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   107
			TileIndex tile = RandomTileSeed(r);
1035
812f837ee03f (svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents: 1005
diff changeset
   108
			if (IsTileType(tile, MP_CLEAR) && GetMapExtraBits(tile) == 2) {
2958
ac0a9673b522 (svn r3520) Remove unused parameters from some functions
tron
parents: 2957
diff changeset
   109
				PlaceTree(tile, r);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   110
			}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   111
		} while (--i);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   112
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   113
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   114
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1059
diff changeset
   115
void GenerateTrees(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   116
{
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   117
	uint i;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   118
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   119
	if (_opt.landscape != LT_CANDY) PlaceMoreTrees();
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   120
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   121
	for (i = _opt.landscape == LT_HILLY ? 15 : 6; i != 0; i--) {
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   122
		PlaceTreesRandomly();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   123
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   124
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   125
1784
d0698aac0c2e (svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents: 1370
diff changeset
   126
/** Plant a tree.
d0698aac0c2e (svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents: 1370
diff changeset
   127
 * @param x,y start tile of area-drag of tree plantation
d0698aac0c2e (svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents: 1370
diff changeset
   128
 * @param p1 tree type, -1 means random.
d0698aac0c2e (svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents: 1370
diff changeset
   129
 * @param p2 end tile of area-drag
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   130
 */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   131
int32 CmdPlantTree(int ex, int ey, uint32 flags, uint32 p1, uint32 p2)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   132
{
3183
90c676e6a50d (svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable
tron
parents: 3144
diff changeset
   133
	StringID msg = INVALID_STRING_ID;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   134
	int32 cost;
2118
aec8042f000b (svn r2628) - Fix: Planting trees does not result in a MapSize() assertion anymore; introduced in r2598
Darkvater
parents: 2088
diff changeset
   135
	int sx, sy, x, y;
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   136
2892
db216dc91941 (svn r3446) - Fix: incorrect validating of tree-planting command which can allow a buffer-overflow (Tron)
Darkvater
parents: 2654
diff changeset
   137
	if (p2 >= MapSize()) return CMD_ERROR;
1784
d0698aac0c2e (svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents: 1370
diff changeset
   138
	/* Check the tree type. It can be random or some valid value within the current climate */
d0698aac0c2e (svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents: 1370
diff changeset
   139
	if (p1 != (uint)-1 && p1 - _tree_base_by_landscape[_opt.landscape] >= _tree_count_by_landscape[_opt.landscape]) return CMD_ERROR;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   140
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   141
	SET_EXPENSES_TYPE(EXPENSES_OTHER);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   142
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   143
	// make sure sx,sy are smaller than ex,ey
2118
aec8042f000b (svn r2628) - Fix: Planting trees does not result in a MapSize() assertion anymore; introduced in r2598
Darkvater
parents: 2088
diff changeset
   144
	sx = TileX(p2);
aec8042f000b (svn r2628) - Fix: Planting trees does not result in a MapSize() assertion anymore; introduced in r2598
Darkvater
parents: 2088
diff changeset
   145
	sy = TileY(p2);
aec8042f000b (svn r2628) - Fix: Planting trees does not result in a MapSize() assertion anymore; introduced in r2598
Darkvater
parents: 2088
diff changeset
   146
	ex /= 16; ey /= 16;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   147
	if (ex < sx) intswap(ex, sx);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   148
	if (ey < sy) intswap(ey, sy);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   149
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   150
	cost = 0; // total cost
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   151
2118
aec8042f000b (svn r2628) - Fix: Planting trees does not result in a MapSize() assertion anymore; introduced in r2598
Darkvater
parents: 2088
diff changeset
   152
	for (x = sx; x <= ex; x++) {
aec8042f000b (svn r2628) - Fix: Planting trees does not result in a MapSize() assertion anymore; introduced in r2598
Darkvater
parents: 2088
diff changeset
   153
		for (y = sy; y <= ey; y++) {
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   154
			TileIndex tile = TileXY(x, y);
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   155
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   156
			if (!EnsureNoVehicle(tile)) continue;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   157
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   158
			switch (GetTileType(tile)) {
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   159
				case MP_TREES:
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   160
					// no more space for trees?
3003
821180e49591 (svn r3583) Fix 2 glitches in r3556
tron
parents: 2981
diff changeset
   161
					if (_game_mode != GM_EDITOR && GetTreeCount(tile) == 3) {
3183
90c676e6a50d (svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable
tron
parents: 3144
diff changeset
   162
						msg = STR_2803_TREE_ALREADY_HERE;
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   163
						continue;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
					}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   165
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   166
					if (flags & DC_EXEC) {
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   167
						AddTreeCount(tile, 1);
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   168
						MarkTileDirtyByTile(tile);
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   169
					}
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   170
					// 2x as expensive to add more trees to an existing tile
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   171
					cost += _price.build_trees * 2;
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   172
					break;
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   173
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   174
				case MP_CLEAR:
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   175
					if (!IsTileOwner(tile, OWNER_NONE)) {
3183
90c676e6a50d (svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable
tron
parents: 3144
diff changeset
   176
						msg = STR_2804_SITE_UNSUITABLE;
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   177
						continue;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
					}
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   179
2955
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
   180
					switch (GetClearGround(tile)) {
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
   181
						case CL_FIELDS: cost += _price.clear_3; break;
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
   182
						case CL_ROCKS:  cost += _price.clear_2; break;
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
   183
						default: break;
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
   184
					}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   185
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   186
					if (flags & DC_EXEC) {
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   187
						TreeType treetype;
3079
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
   188
						uint growth;
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   189
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   190
						if (_game_mode != GM_EDITOR && _current_player < MAX_PLAYERS) {
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   191
							Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority);
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   192
							if (t != NULL)
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   193
								ChangeTownRating(t, RATING_TREE_UP_STEP, RATING_TREE_MAXIMUM);
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   194
						}
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   195
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   196
						treetype = p1;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   197
						if (treetype == TR_INVALID) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   198
							treetype = GetRandomTreeType(tile, GB(Random(), 24, 8));
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   199
							if (treetype == TR_INVALID) treetype = TR_CACTUS;
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   200
						}
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   201
3079
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
   202
						growth = _game_mode == GM_EDITOR ? 3 : 0;
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   203
						switch (GetClearGround(tile)) {
3079
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
   204
							case CL_ROUGH: MakeTree(tile, treetype, 0, growth, TR_ROUGH, 0); break;
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
   205
							case CL_SNOW:  MakeTree(tile, treetype, 0, growth, TR_SNOW_DESERT, GetClearDensity(tile)); break;
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
   206
							default:       MakeTree(tile, treetype, 0, growth, TR_GRASS, 0); break;
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   207
						}
3003
821180e49591 (svn r3583) Fix 2 glitches in r3556
tron
parents: 2981
diff changeset
   208
						MarkTileDirtyByTile(tile);
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   209
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   210
						if (_game_mode == GM_EDITOR && IS_INT_INSIDE(treetype, TR_RAINFOREST, TR_CACTUS))
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   211
							SetMapExtraBits(tile, 2);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   212
					}
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   213
					cost += _price.build_trees;
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   214
					break;
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   215
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   216
				default:
3183
90c676e6a50d (svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable
tron
parents: 3144
diff changeset
   217
					msg = STR_2804_SITE_UNSUITABLE;
1286
10b9fe28effc (svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents: 1209
diff changeset
   218
					break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   219
			}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   220
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   221
	}
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   222
3183
90c676e6a50d (svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable
tron
parents: 3144
diff changeset
   223
	if (cost == 0) {
90c676e6a50d (svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable
tron
parents: 3144
diff changeset
   224
		return_cmd_error(msg);
90c676e6a50d (svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable
tron
parents: 3144
diff changeset
   225
	} else {
90c676e6a50d (svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable
tron
parents: 3144
diff changeset
   226
		return cost;
90c676e6a50d (svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable
tron
parents: 3144
diff changeset
   227
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   228
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   229
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   230
typedef struct TreeListEnt {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   231
	uint32 image;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   232
	byte x,y;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   233
} TreeListEnt;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   234
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   235
static void DrawTile_Trees(TileInfo *ti)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   236
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   237
	const uint32 *s;
2654
1370de8783d3 (svn r3196) Use structs instead of magic offsets into arrays
tron
parents: 2644
diff changeset
   238
	const TreePos* d;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   239
	byte z;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   240
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   241
	switch (GetTreeGround(ti->tile)) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   242
		case TR_GRASS: DrawClearLandTile(ti, 3); break;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   243
		case TR_ROUGH: DrawHillyLandTile(ti); break;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   244
		default:       DrawGroundSprite(_tree_sprites_1[GetTreeDensity(ti->tile)] + _tileh_to_sprite[ti->tileh]); break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   245
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   246
2220
cacd492f3c1c (svn r2738) Small bit fiddling cleanup
tron
parents: 2186
diff changeset
   247
	DrawClearLandFence(ti);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   248
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   249
	z = ti->z;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   250
	if (ti->tileh != 0) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   251
		z += 4;
2085
876f20a0e843 (svn r2595) -Codechange: Introduced "IsSteepTileh" to find whether a tile is steep
celestar
parents: 2051
diff changeset
   252
		if (IsSteepTileh(ti->tileh))
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   253
			z += 4;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   254
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   255
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   256
	{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   257
		uint16 tmp = ti->x;
959
e6a3bbda610f (svn r1451) Fix some of the signed/unsigned comparison warnings
tron
parents: 926
diff changeset
   258
		uint index;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   259
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   260
		tmp = ROR(tmp, 2);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   261
		tmp -= ti->y;
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   262
		tmp = ROR(tmp, 3);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   263
		tmp -= ti->x;
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   264
		tmp = ROR(tmp, 1);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   265
		tmp += ti->y;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   266
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   267
		d = _tree_layout_xy[GB(tmp, 4, 2)];
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   268
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   269
		index = GB(tmp, 6, 2) + (GetTreeType(ti->tile) << 2);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   270
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   271
		/* different tree styles above one of the grounds */
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   272
		if (GetTreeGround(ti->tile) == TR_SNOW_DESERT &&
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   273
				GetTreeDensity(ti->tile) >= 2 &&
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   274
				IS_INT_INSIDE(index, TR_SUB_ARCTIC << 2, TR_RAINFOREST << 2)) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   275
			index += 164 - (TR_SUB_ARCTIC << 2);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   276
		}
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   277
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   278
		assert(index < lengthof(_tree_layout_sprite));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   279
		s = _tree_layout_sprite[index];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   280
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   281
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   282
	StartSpriteCombine();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   283
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   284
	if (!(_display_opt & DO_TRANS_BUILDINGS) || !_patches.invisible_trees) {
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   285
		TreeListEnt te[4];
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   286
		uint i;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   287
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   288
		/* put the trees to draw in a list */
3271
114243e3465f (svn r3983) Use existing functions to access tree and road info
tron
parents: 3183
diff changeset
   289
		i = GetTreeCount(ti->tile) + 1;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   290
		do {
3271
114243e3465f (svn r3983) Use existing functions to access tree and road info
tron
parents: 3183
diff changeset
   291
			uint32 image = s[0] + (--i == 0 ? GetTreeGrowth(ti->tile) : 3);
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2635
diff changeset
   292
			if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   293
			te[i].image = image;
2654
1370de8783d3 (svn r3196) Use structs instead of magic offsets into arrays
tron
parents: 2644
diff changeset
   294
			te[i].x = d->x;
1370de8783d3 (svn r3196) Use structs instead of magic offsets into arrays
tron
parents: 2644
diff changeset
   295
			te[i].y = d->y;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   296
			s++;
2654
1370de8783d3 (svn r3196) Use structs instead of magic offsets into arrays
tron
parents: 2644
diff changeset
   297
			d++;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   298
		} while (i);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   299
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   300
		/* draw them in a sorted way */
2952
58522ed8f0f1 (svn r3511) More whitespace ([FS#46] by Rubidium)
tron
parents: 2912
diff changeset
   301
		for (;;) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   302
			byte min = 0xFF;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   303
			TreeListEnt *tep = NULL;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   304
3271
114243e3465f (svn r3983) Use existing functions to access tree and road info
tron
parents: 3183
diff changeset
   305
			i = GetTreeCount(ti->tile) + 1;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   306
			do {
2644
58206d08cf9d (svn r3186) Unnecessary casts and truncation
tron
parents: 2639
diff changeset
   307
				if (te[--i].image != 0 && te[i].x + te[i].y < min) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   308
					min = te[i].x + te[i].y;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   309
					tep = &te[i];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   310
				}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   311
			} while (i);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   312
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   313
			if (tep == NULL) break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   314
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   315
			AddSortableSpriteToDraw(tep->image, ti->x + tep->x, ti->y + tep->y, 5, 5, 0x10, z);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   316
			tep->image = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   317
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   318
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   319
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   320
	EndSpriteCombine();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   321
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   322
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   323
2537
5e4ca74e995a (svn r3066) Constify the parameter of GetSlopeZ_*()
tron
parents: 2436
diff changeset
   324
static uint GetSlopeZ_Trees(const TileInfo* ti)
5e4ca74e995a (svn r3066) Constify the parameter of GetSlopeZ_*()
tron
parents: 2436
diff changeset
   325
{
2243
b7e58afa3616 (svn r2763) Small cleanup and improve a few comments
tron
parents: 2238
diff changeset
   326
	return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   327
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   328
2548
49c8a096033f (svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents: 2537
diff changeset
   329
static uint GetSlopeTileh_Trees(const TileInfo* ti)
49c8a096033f (svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents: 2537
diff changeset
   330
{
39
d177340ed556 (svn r40) Final slope graphics fix
dominik
parents: 0
diff changeset
   331
	return ti->tileh;
d177340ed556 (svn r40) Final slope graphics fix
dominik
parents: 0
diff changeset
   332
}
d177340ed556 (svn r40) Final slope graphics fix
dominik
parents: 0
diff changeset
   333
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1902
diff changeset
   334
static int32 ClearTile_Trees(TileIndex tile, byte flags)
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1902
diff changeset
   335
{
2243
b7e58afa3616 (svn r2763) Small cleanup and improve a few comments
tron
parents: 2238
diff changeset
   336
	uint num;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   337
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   338
	if (flags & DC_EXEC && _current_player < MAX_PLAYERS) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   339
		Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   340
		if (t != NULL)
1005
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 988
diff changeset
   341
			ChangeTownRating(t, RATING_TREE_DOWN_STEP, RATING_TREE_MINIMUM);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   342
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   343
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   344
	num = GetTreeCount(tile) + 1;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   345
	if (IS_INT_INSIDE(GetTreeType(tile), TR_RAINFOREST, TR_CACTUS)) num *= 4;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   346
2243
b7e58afa3616 (svn r2763) Small cleanup and improve a few comments
tron
parents: 2238
diff changeset
   347
	if (flags & DC_EXEC) DoClearSquare(tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   348
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   349
	return num * _price.remove_trees;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   350
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   351
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1902
diff changeset
   352
static void GetAcceptedCargo_Trees(TileIndex tile, AcceptedCargo ac)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   353
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   354
	/* not used */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   355
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   356
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1902
diff changeset
   357
static void GetTileDesc_Trees(TileIndex tile, TileDesc *td)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   358
{
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   359
	TreeType tt = GetTreeType(tile);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   360
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   361
	if (IS_INT_INSIDE(tt, TR_RAINFOREST, TR_CACTUS)) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   362
		td->str = STR_280F_RAINFOREST;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   363
	} else if (tt == TR_CACTUS) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   364
		td->str = STR_2810_CACTUS_PLANTS;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   365
	} else {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   366
		td->str = STR_280E_TREES;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   367
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   368
1901
03bf9bf99319 (svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner
tron
parents: 1891
diff changeset
   369
	td->owner = GetTileOwner(tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   370
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   371
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1902
diff changeset
   372
static void AnimateTile_Trees(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   373
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   374
	/* not used */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   375
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   376
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1902
diff changeset
   377
static void TileLoopTreesDesert(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   378
{
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   379
	switch (GetMapExtraBits(tile)) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   380
		case 1:
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   381
			if (GetTreeGround(tile) != TR_SNOW_DESERT) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   382
				SetTreeGroundDensity(tile, TR_SNOW_DESERT, 3);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   383
				MarkTileDirtyByTile(tile);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   384
			}
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   385
			break;
2243
b7e58afa3616 (svn r2763) Small cleanup and improve a few comments
tron
parents: 2238
diff changeset
   386
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   387
		case 2: {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   388
			static const SoundFx forest_sounds[] = {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   389
				SND_42_LOON_BIRD,
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   390
				SND_43_LION,
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   391
				SND_44_MONKEYS,
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   392
				SND_48_DISTANT_BIRD
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   393
			};
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   394
			uint32 r = Random();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   395
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   396
			if (CHANCE16I(1, 200, r)) SndPlayTileFx(forest_sounds[GB(r, 16, 2)], tile);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   397
			break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   398
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   399
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   400
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   401
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1902
diff changeset
   402
static void TileLoopTreesAlps(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   403
{
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   404
	int k = GetTileZ(tile) - _opt.snow_line;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   405
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   406
	if (k < -8) {
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   407
		if (GetTreeGround(tile) != TR_SNOW_DESERT) return;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   408
		SetTreeGroundDensity(tile, TR_GRASS, 0);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   409
	} else {
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   410
		uint density = min((uint)(k + 8) / 8, 3);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   411
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   412
		if (GetTreeGround(tile) != TR_SNOW_DESERT || GetTreeDensity(tile) != density) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   413
			SetTreeGroundDensity(tile, TR_SNOW_DESERT, density);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   414
		} else {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   415
			if (GetTreeDensity(tile) == 3) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   416
				uint32 r = Random();
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   417
				if (CHANCE16I(1, 200, r)) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   418
					SndPlayTileFx((r & 0x80000000) ? SND_39_HEAVY_WIND : SND_34_WIND, tile);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   419
				}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   420
			}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   421
			return;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   422
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   423
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   424
	MarkTileDirtyByTile(tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   425
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   426
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1902
diff changeset
   427
static void TileLoop_Trees(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   428
{
909
65cdb609b7a6 (svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents: 881
diff changeset
   429
	static const TileIndexDiffC _tileloop_trees_dir[] = {
65cdb609b7a6 (svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents: 881
diff changeset
   430
		{-1, -1},
65cdb609b7a6 (svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents: 881
diff changeset
   431
		{ 0, -1},
65cdb609b7a6 (svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents: 881
diff changeset
   432
		{ 1, -1},
65cdb609b7a6 (svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents: 881
diff changeset
   433
		{-1,  0},
65cdb609b7a6 (svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents: 881
diff changeset
   434
		{ 1,  0},
65cdb609b7a6 (svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents: 881
diff changeset
   435
		{-1,  1},
65cdb609b7a6 (svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents: 881
diff changeset
   436
		{ 0,  1},
65cdb609b7a6 (svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents: 881
diff changeset
   437
		{ 1,  1}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   438
	};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   439
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   440
	switch (_opt.landscape) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   441
		case LT_DESERT: TileLoopTreesDesert(tile); break;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   442
		case LT_HILLY:  TileLoopTreesAlps(tile);   break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   443
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   444
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   445
	TileLoopClearHelper(tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   446
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   447
	if (GetTreeCounter(tile) < 15) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   448
		AddTreeCounter(tile, 1);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   449
		return;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   450
	}
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   451
	SetTreeCounter(tile, 0);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   452
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   453
	switch (GetTreeGrowth(tile)) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   454
		case 3: /* regular sized tree */
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   455
			if (_opt.landscape == LT_DESERT && GetTreeType(tile) != TR_CACTUS && GetMapExtraBits(tile) == 1) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   456
				AddTreeGrowth(tile, 1);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   457
			} else {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   458
				switch (GB(Random(), 0, 3)) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   459
					case 0: /* start destructing */
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   460
						AddTreeGrowth(tile, 1);
2955
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
   461
						break;
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
   462
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   463
					case 1: /* add a tree */
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   464
						if (GetTreeCount(tile) < 3) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   465
							AddTreeCount(tile, 1);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   466
							SetTreeGrowth(tile, 0);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   467
							break;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   468
						}
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   469
						/* FALL THROUGH */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   470
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   471
					case 2: { /* add a neighbouring tree */
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   472
						TreeType treetype = GetTreeType(tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   473
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   474
						tile += ToTileIndexDiff(_tileloop_trees_dir[Random() & 7]);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   475
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   476
						if (!IsTileType(tile, MP_CLEAR)) return;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   477
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   478
						switch (GetClearGround(tile)) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   479
							case CL_GRASS:
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   480
								if (GetClearDensity(tile) != 3) return;
3079
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
   481
								MakeTree(tile, treetype, 0, 0, TR_GRASS, 0);
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   482
								break;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   483
3079
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
   484
							case CL_ROUGH: MakeTree(tile, treetype, 0, 0, TR_ROUGH, 0); break;
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
   485
							case CL_SNOW:  MakeTree(tile, treetype, 0, 0, TR_SNOW_DESERT, GetClearDensity(tile)); break;
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   486
							default: return;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   487
						}
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   488
						break;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   489
					}
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   490
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   491
					default:
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   492
						return;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   493
				}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   494
			}
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   495
			break;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   496
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   497
		case 6: /* final stage of tree destruction */
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   498
			if (GetTreeCount(tile) > 0) {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   499
				/* more than one tree, delete it */
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   500
				AddTreeCount(tile, -1);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   501
				SetTreeGrowth(tile, 3);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   502
			} else {
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   503
				/* just one tree, change type into MP_CLEAR */
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   504
				switch (GetTreeGround(tile)) {
3076
8b54ff8fa90a (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 3017
diff changeset
   505
					case TR_GRASS: MakeClear(tile, CL_GRASS, 3); break;
8b54ff8fa90a (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 3017
diff changeset
   506
					case TR_ROUGH: MakeClear(tile, CL_ROUGH, 3); break;
8b54ff8fa90a (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 3017
diff changeset
   507
					default:       MakeClear(tile, CL_SNOW, GetTreeDensity(tile)); break;
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   508
				}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   509
			}
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   510
			break;
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   511
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   512
		default:
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   513
			AddTreeGrowth(tile, 1);
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   514
			break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   515
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   516
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   517
	MarkTileDirtyByTile(tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   518
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   519
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1059
diff changeset
   520
void OnTick_Trees(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   521
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   522
	uint32 r;
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1902
diff changeset
   523
	TileIndex tile;
2955
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
   524
	ClearGround ct;
3017
a75caf4efa2d (svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff
tron
parents: 3003
diff changeset
   525
	TreeType tree;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   526
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   527
	/* place a tree at a random rainforest spot */
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   528
	if (_opt.landscape == LT_DESERT &&
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   529
			(r = Random(), tile = RandomTileSeed(r), GetMapExtraBits(tile) == 2) &&
1035
812f837ee03f (svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents: 1005
diff changeset
   530
			IsTileType(tile, MP_CLEAR) &&
2955
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
   531
			(ct = GetClearGround(tile), ct == CL_GRASS || ct == CL_ROUGH) &&
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   532
			(tree = GetRandomTreeType(tile, GB(r, 24, 8))) != TR_INVALID) {
3079
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
   533
		MakeTree(tile, tree, 0, 0, ct == CL_ROUGH ? TR_ROUGH : TR_GRASS, 0);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   534
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   535
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   536
	// byte underflow
2088
d7a97ef74701 (svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents: 2085
diff changeset
   537
	if (--_trees_tick_ctr != 0) return;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 160
diff changeset
   538
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   539
	/* place a tree at a random spot */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   540
	r = Random();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   541
	tile = TILE_MASK(r);
1035
812f837ee03f (svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents: 1005
diff changeset
   542
	if (IsTileType(tile, MP_CLEAR) &&
2955
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
   543
			(ct = GetClearGround(tile), ct == CL_GRASS || ct == CL_ROUGH || ct == CL_SNOW) &&
2981
ca5959cf9fc7 (svn r3556) Add accessors for handling tree tiles
tron
parents: 2968
diff changeset
   544
			(tree = GetRandomTreeType(tile, GB(r, 24, 8))) != TR_INVALID) {
2955
24de69e236d2 (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents: 2952
diff changeset
   545
		switch (ct) {
3079
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
   546
			case CL_GRASS: MakeTree(tile, tree, 0, 0, TR_GRASS, 0); break;
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
   547
			case CL_ROUGH: MakeTree(tile, tree, 0, 0, TR_ROUGH, 0); break;
a26f87fba4c1 (svn r3668) Add a function to turn a tile into a tree tile
tron
parents: 3076
diff changeset
   548
			default:       MakeTree(tile, tree, 0, 0, TR_SNOW_DESERT, GetClearDensity(tile)); break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   549
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   550
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   551
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   552
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1902
diff changeset
   553
static void ClickTile_Trees(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   554
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   555
	/* not used */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   556
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   557
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1902
diff changeset
   558
static uint32 GetTileTrackStatus_Trees(TileIndex tile, TransportType mode)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   559
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   560
	return 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   561
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   562
2436
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2243
diff changeset
   563
static void ChangeTileOwner_Trees(TileIndex tile, PlayerID old_player, PlayerID new_player)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   564
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   565
	/* not used */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   566
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   567
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1059
diff changeset
   568
void InitializeTrees(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   569
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   570
	_trees_tick_ctr = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   571
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   572
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   573
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   574
const TileTypeProcs _tile_type_trees_procs = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   575
	DrawTile_Trees,						/* draw_tile_proc */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   576
	GetSlopeZ_Trees,					/* get_slope_z_proc */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   577
	ClearTile_Trees,					/* clear_tile_proc */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   578
	GetAcceptedCargo_Trees,		/* get_accepted_cargo_proc */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   579
	GetTileDesc_Trees,				/* get_tile_desc_proc */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   580
	GetTileTrackStatus_Trees,	/* get_tile_track_status_proc */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   581
	ClickTile_Trees,					/* click_tile_proc */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   582
	AnimateTile_Trees,				/* animate_tile_proc */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   583
	TileLoop_Trees,						/* tile_loop_clear */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   584
	ChangeTileOwner_Trees,		/* change_tile_owner_clear */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   585
	NULL,											/* get_produced_cargo_proc */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   586
	NULL,											/* vehicle_enter_tile_proc */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   587
	NULL,											/* vehicle_leave_tile_proc */
39
d177340ed556 (svn r40) Final slope graphics fix
dominik
parents: 0
diff changeset
   588
	GetSlopeTileh_Trees,			/* get_slope_tileh_proc */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   589
};