src/tile_type.h
author terom@frrb.lan
Fri, 19 Dec 2008 01:32:07 +0200
changeset 10438 51bff16a04c9
parent 10233 ac41e2898d9b
permissions -rw-r--r--
initial mini-map stuff
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2125
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2125
diff changeset
     2
8108
b42a0e5c67ef (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7370
diff changeset
     3
/** @file tile_type.h Types related to tiles. */
6422
6679df1c05ba (svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas
parents: 6248
diff changeset
     4
8108
b42a0e5c67ef (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7370
diff changeset
     5
#ifndef TILE_TYPE_H
b42a0e5c67ef (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7370
diff changeset
     6
#define TILE_TYPE_H
926
a6d140a6a4de (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
8108
b42a0e5c67ef (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7370
diff changeset
     8
#include "core/enum_type.hpp"
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: 979
diff changeset
     9
8138
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    10
enum {
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    11
	TILE_SIZE   = 16,   ///< Tiles are 16x16 "units" in size
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    12
	TILE_PIXELS = 32,   ///< a tile is 32x32 pixels
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    13
	TILE_HEIGHT =  8,   ///< The standard height-difference between tiles on two levels is 8 (z-diff 8)
7313
a36dc43afcb5 (svn r10665) -Codechange: replace magic 15 with MAX_TILE_HEIGHT (bilbo)
truelight
parents: 6422
diff changeset
    14
8138
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    15
	MAX_TILE_HEIGHT     = 15,                    ///< Maximum allowed tile height
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    16
	MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2), ///< Maximum allowed snowline height
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    17
};
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    18
7313
a36dc43afcb5 (svn r10665) -Codechange: replace magic 15 with MAX_TILE_HEIGHT (bilbo)
truelight
parents: 6422
diff changeset
    19
7365
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    20
/**
10233
ac41e2898d9b (svn r14461) -Document: add some doxygen comments (Albert)
rubidium
parents: 8450
diff changeset
    21
 * The different types of tiles.
7365
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    22
 *
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    23
 * Each tile belongs to one type, according whatever is build on it.
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    24
 *
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    25
 * @note A railway with a crossing street is marked as MP_ROAD.
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    26
 */
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5596
diff changeset
    27
enum TileType {
7365
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    28
	MP_CLEAR,               ///< A tile without any structures, i.e. grass, rocks, farm fields etc.
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    29
	MP_RAILWAY,             ///< A railway
7370
41adc721b1fa (svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents: 7365
diff changeset
    30
	MP_ROAD,                ///< A tile with road (or tram tracks)
7365
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    31
	MP_HOUSE,               ///< A house by a town
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    32
	MP_TREES,               ///< Tile got trees
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    33
	MP_STATION,             ///< A tile of a station
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    34
	MP_WATER,               ///< Water tile
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    35
	MP_VOID,                ///< Invisible tiles at the SW and SE border
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    36
	MP_INDUSTRY,            ///< Part of an industry
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    37
	MP_TUNNELBRIDGE,        ///< Tunnel entry/exit and bridge heads
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    38
	MP_UNMOVABLE,           ///< Contains an object with cannot be removed like transmitters
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5596
diff changeset
    39
};
1214
8262981ac274 (svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents: 1211
diff changeset
    40
7365
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    41
/**
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    42
 * Additional infos of a tile on a tropic game.
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    43
 *
8450
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8138
diff changeset
    44
 * The tropiczone is not modified during gameplay. It mainly affects tree growth. (desert tiles are visible though)
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8138
diff changeset
    45
 *
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8138
diff changeset
    46
 * In randomly generated maps:
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8138
diff changeset
    47
 *  TROPICZONE_DESERT: Generated everywhere, if there is neither water nor mountains (TileHeight >= 4) in a certain distance from the tile.
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8138
diff changeset
    48
 *  TROPICZONE_RAINFOREST: Genereated everywhere, if there is no desert in a certain distance from the tile.
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8138
diff changeset
    49
 *  TROPICZONE_NORMAL: Everywhere else, i.e. between desert and rainforest and on sea (if you clear the water).
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8138
diff changeset
    50
 *
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8138
diff changeset
    51
 * In scenarios:
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8138
diff changeset
    52
 *  TROPICZONE_NORMAL: Default value.
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8138
diff changeset
    53
 *  TROPICZONE_DESERT: Placed manually.
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8138
diff changeset
    54
 *  TROPICZONE_RAINFOREST: Placed if you plant certain rainforest-trees.
7365
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    55
 */
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5596
diff changeset
    56
enum TropicZone {
8450
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8138
diff changeset
    57
	TROPICZONE_NORMAL     = 0,      ///< Normal tropiczone
7365
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    58
	TROPICZONE_DESERT     = 1,      ///< Tile is desert
7370
41adc721b1fa (svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents: 7365
diff changeset
    59
	TROPICZONE_RAINFOREST = 2,      ///< Rainforest tile
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5596
diff changeset
    60
};
1211
43ae74415fdd (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents: 1209
diff changeset
    61
7365
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    62
/**
8108
b42a0e5c67ef (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7370
diff changeset
    63
 * The index/ID of a Tile.
7365
32d244531e1a (svn r10728) -Documentation [FS#1088]: of tile.h. Based on a patch by Progman.
rubidium
parents: 7313
diff changeset
    64
 */
8108
b42a0e5c67ef (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7370
diff changeset
    65
typedef uint32 TileIndex;
1330
5d76a0522a11 (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
8138
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    67
/**
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    68
 * The very nice invalid tile marker
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    69
 */
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    70
static const TileIndex INVALID_TILE = (TileIndex)-1;
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8108
diff changeset
    71
8108
b42a0e5c67ef (svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents: 7370
diff changeset
    72
#endif /* TILE_TYPE_H */