src/tile_type.h
author rubidium
Fri, 04 Jul 2008 19:00:11 +0000
changeset 11118 f66e0a4ce878
parent 8946 85eff1ad8cda
permissions -rw-r--r--
(svn r13676) -Fix [FS#2126]: inactive companies from old (TTD) saves could be marked active in some cases, which then loads garbage in their statistics and such.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2125
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2125
diff changeset
     2
8604
8afdd9877afd (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7866
diff changeset
     3
/** @file tile_type.h Types related to tiles. */
6918
5589c415e28f (svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas
parents: 6574
diff changeset
     4
8604
8afdd9877afd (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7866
diff changeset
     5
#ifndef TILE_TYPE_H
8afdd9877afd (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7866
diff changeset
     6
#define TILE_TYPE_H
926
bd4312619522 (svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents: 909
diff changeset
     7
8604
8afdd9877afd (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7866
diff changeset
     8
#include "core/enum_type.hpp"
1035
0a170deb6e33 (svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents: 979
diff changeset
     9
8634
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    10
enum {
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    11
	TILE_SIZE   = 16,   ///< Tiles are 16x16 "units" in size
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    12
	TILE_PIXELS = 32,   ///< a tile is 32x32 pixels
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    13
	TILE_HEIGHT =  8,   ///< The standard height-difference between tiles on two levels is 8 (z-diff 8)
7809
40156c450f13 (svn r10665) -Codechange: replace magic 15 with MAX_TILE_HEIGHT (bilbo)
truelight
parents: 6918
diff changeset
    14
8634
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    15
	MAX_TILE_HEIGHT     = 15,                    ///< Maximum allowed tile height
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    16
	MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2), ///< Maximum allowed snowline height
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    17
};
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    18
7809
40156c450f13 (svn r10665) -Codechange: replace magic 15 with MAX_TILE_HEIGHT (bilbo)
truelight
parents: 6918
diff changeset
    19
7861
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    20
/**
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    21
 * The different type of a tile.
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    22
 *
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    23
 * Each tile belongs to one type, according whatever is build on it.
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    24
 *
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    25
 * @note A railway with a crossing street is marked as MP_ROAD.
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    26
 */
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5847
diff changeset
    27
enum TileType {
7861
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    28
	MP_CLEAR,               ///< A tile without any structures, i.e. grass, rocks, farm fields etc.
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    29
	MP_RAILWAY,             ///< A railway
7866
e19fda04e8d3 (svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents: 7861
diff changeset
    30
	MP_ROAD,                ///< A tile with road (or tram tracks)
7861
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    31
	MP_HOUSE,               ///< A house by a town
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    32
	MP_TREES,               ///< Tile got trees
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    33
	MP_STATION,             ///< A tile of a station
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    34
	MP_WATER,               ///< Water tile
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    35
	MP_VOID,                ///< Invisible tiles at the SW and SE border
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    36
	MP_INDUSTRY,            ///< Part of an industry
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    37
	MP_TUNNELBRIDGE,        ///< Tunnel entry/exit and bridge heads
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    38
	MP_UNMOVABLE,           ///< Contains an object with cannot be removed like transmitters
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5847
diff changeset
    39
};
1214
33e07bbb7779 (svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents: 1211
diff changeset
    40
7861
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    41
/**
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    42
 * Additional infos of a tile on a tropic game.
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    43
 *
8946
85eff1ad8cda (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8634
diff changeset
    44
 * The tropiczone is not modified during gameplay. It mainly affects tree growth. (desert tiles are visible though)
85eff1ad8cda (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8634
diff changeset
    45
 *
85eff1ad8cda (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8634
diff changeset
    46
 * In randomly generated maps:
85eff1ad8cda (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8634
diff changeset
    47
 *  TROPICZONE_DESERT: Generated everywhere, if there is neither water nor mountains (TileHeight >= 4) in a certain distance from the tile.
85eff1ad8cda (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8634
diff changeset
    48
 *  TROPICZONE_RAINFOREST: Genereated everywhere, if there is no desert in a certain distance from the tile.
85eff1ad8cda (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8634
diff changeset
    49
 *  TROPICZONE_NORMAL: Everywhere else, i.e. between desert and rainforest and on sea (if you clear the water).
85eff1ad8cda (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8634
diff changeset
    50
 *
85eff1ad8cda (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8634
diff changeset
    51
 * In scenarios:
85eff1ad8cda (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8634
diff changeset
    52
 *  TROPICZONE_NORMAL: Default value.
85eff1ad8cda (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8634
diff changeset
    53
 *  TROPICZONE_DESERT: Placed manually.
85eff1ad8cda (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8634
diff changeset
    54
 *  TROPICZONE_RAINFOREST: Placed if you plant certain rainforest-trees.
7861
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    55
 */
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5847
diff changeset
    56
enum TropicZone {
8946
85eff1ad8cda (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8634
diff changeset
    57
	TROPICZONE_NORMAL     = 0,      ///< Normal tropiczone
7861
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    58
	TROPICZONE_DESERT     = 1,      ///< Tile is desert
7866
e19fda04e8d3 (svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents: 7861
diff changeset
    59
	TROPICZONE_RAINFOREST = 2,      ///< Rainforest tile
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5847
diff changeset
    60
};
1211
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents: 1209
diff changeset
    61
7861
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    62
/**
8604
8afdd9877afd (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7866
diff changeset
    63
 * The index/ID of a Tile.
7861
e45fe49dbe58 (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7809
diff changeset
    64
 */
8604
8afdd9877afd (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7866
diff changeset
    65
typedef uint32 TileIndex;
1330
8a67d04016ce (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1214
diff changeset
    66
8634
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    67
/**
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    68
 * The very nice invalid tile marker
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    69
 */
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    70
static const TileIndex INVALID_TILE = (TileIndex)-1;
5ffca02f9115 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8604
diff changeset
    71
8604
8afdd9877afd (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7866
diff changeset
    72
#endif /* TILE_TYPE_H */