Fix crash when setting separation mode for vehicles with no orders list.
[openttd-joker.git] / src / tile_type.h
blob9809244b4c19e1bedcb5446351aab474bba05234
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
10 /** @file tile_type.h Types related to tiles. */
12 #ifndef TILE_TYPE_H
13 #define TILE_TYPE_H
15 static const uint TILE_SIZE = 16; ///< Tile size in world coordinates.
16 static const uint TILE_UNIT_MASK = TILE_SIZE - 1; ///< For masking in/out the inner-tile world coordinate units.
17 static const uint TILE_PIXELS = 32; ///< Pixel distance between tile columns/rows in #ZOOM_LVL_BASE.
18 static const uint TILE_HEIGHT = 8; ///< Height of a height level in world coordinate AND in pixels in #ZOOM_LVL_BASE.
20 static const uint MAX_BUILDING_PIXELS = 200; ///< Maximum height of a building in pixels in #ZOOM_LVL_BASE. (Also applies to "bridge buildings" on the bridge floor.)
21 static const int MAX_VEHICLE_PIXEL_X = 192; ///< Maximum width of a vehicle in pixels in #ZOOM_LVL_BASE.
22 static const int MAX_VEHICLE_PIXEL_Y = 96; ///< Maximum height of a vehicle in pixels in #ZOOM_LVL_BASE.
24 static const uint MAX_TILE_HEIGHT = 255; ///< Maximum allowed tile height
26 static const uint MIN_MAX_HEIGHTLEVEL = 15; ///< Lower bound of maximum allowed heightlevel (in the construction settings)
27 static const uint DEF_MAX_HEIGHTLEVEL = 30; ///< Default maximum allowed heightlevel (in the construction settings)
28 static const uint MAX_MAX_HEIGHTLEVEL = MAX_TILE_HEIGHT; ///< Upper bound of maximum allowed heightlevel (in the construction settings)
30 static const uint MIN_SNOWLINE_HEIGHT = 2; ///< Minimum snowline height
31 static const uint DEF_SNOWLINE_HEIGHT = 15; ///< Default snowline height
32 static const uint MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2); ///< Maximum allowed snowline height
34 static const uint MIN_MIN_RIVER_LENGTH = 2; ///< Minimum snowline height
35 static const uint DEF_MIN_RIVER_LENGTH = 16; ///< Default snowline height
36 static const uint MAX_MIN_RIVER_LENGTH = 255; ///< Maximum allowed snowline height
38 static const uint MIN_TREELINE_HEIGHT = 2; ///< Minimum treeline height
39 static const uint DEF_TREELINE_HEIGHT = 15; ///< Default treeline height
40 static const uint MAX_TREELINE_HEIGHT = (MAX_TILE_HEIGHT - 2); ///< Maximum allowed treeline height
42 static const uint MIN_DESERT_AMOUNT = 2; ///< Minimum allowed desert amount.
43 static const uint DEF_DESERT_AMOUNT = 4; ///< Default desert amount.
44 static const uint MAX_DESERT_AMOUNT = (MAX_TILE_HEIGHT - 2); ///< Maximum allowed desert amount.
47 /**
48 * The different types of tiles.
50 * Each tile belongs to one type, according whatever is build on it.
52 * @note A railway with a crossing street is marked as MP_ROAD.
54 enum TileType {
55 MP_CLEAR, ///< A tile without any structures, i.e. grass, rocks, farm fields etc.
56 MP_RAILWAY, ///< A railway
57 MP_ROAD, ///< A tile with road (or tram tracks)
58 MP_HOUSE, ///< A house by a town
59 MP_TREES, ///< Tile got trees
60 MP_STATION, ///< A tile of a station
61 MP_WATER, ///< Water tile
62 MP_VOID, ///< Invisible tiles at the SW and SE border
63 MP_INDUSTRY, ///< Part of an industry
64 MP_TUNNELBRIDGE, ///< Tunnel entry/exit and bridge heads
65 MP_OBJECT, ///< Contains objects such as transmitters and owned land
68 /**
69 * Additional infos of a tile on a tropic game.
71 * The tropiczone is not modified during gameplay. It mainly affects tree growth. (desert tiles are visible though)
73 * In randomly generated maps:
74 * TROPICZONE_DESERT: Generated everywhere, if there is neither water nor mountains (TileHeight >= 4) in a certain distance from the tile.
75 * TROPICZONE_RAINFOREST: Generated everywhere, if there is no desert in a certain distance from the tile.
76 * TROPICZONE_NORMAL: Everywhere else, i.e. between desert and rainforest and on sea (if you clear the water).
78 * In scenarios:
79 * TROPICZONE_NORMAL: Default value.
80 * TROPICZONE_DESERT: Placed manually.
81 * TROPICZONE_RAINFOREST: Placed if you plant certain rainforest-trees.
83 enum TropicZone {
84 TROPICZONE_NORMAL = 0, ///< Normal tropiczone
85 TROPICZONE_DESERT = 1, ///< Tile is desert
86 TROPICZONE_RAINFOREST = 2, ///< Rainforest tile
89 /**
90 * The index/ID of a Tile.
92 typedef uint32 TileIndex;
94 /**
95 * The very nice invalid tile marker
97 static const TileIndex INVALID_TILE = (TileIndex)-1;
99 #endif /* TILE_TYPE_H */