(svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
parent
2cf7d5b2cb
commit
be923601bf
@ -0,0 +1,101 @@
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* @file slope_type.h Definitions of a slope.
|
||||
* This file defines the enumeration and helper functions for handling
|
||||
* the slope info of a tile.
|
||||
*/
|
||||
|
||||
#ifndef SLOPE_TYPE_H
|
||||
#define SLOPE_TYPE_H
|
||||
|
||||
#include "core/enum_type.hpp"
|
||||
|
||||
/**
|
||||
* Enumeration of tile corners
|
||||
*/
|
||||
enum Corner {
|
||||
CORNER_W = 0,
|
||||
CORNER_S = 1,
|
||||
CORNER_E = 2,
|
||||
CORNER_N = 3,
|
||||
CORNER_END,
|
||||
CORNER_INVALID = 0xFF
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Enumeration for the slope-type.
|
||||
*
|
||||
* This enumeration use the chars N,E,S,W corresponding the
|
||||
* direction north, east, south and west. The top corner of a tile
|
||||
* is the north-part of the tile. The whole slope is encoded with
|
||||
* 5 bits, 4 bits for each corner and 1 bit for a steep-flag.
|
||||
*
|
||||
* For halftile slopes an extra 3 bits are used to represent this
|
||||
* properly; 1 bit for a halftile-flag and 2 bits to encode which
|
||||
* extra side (corner) is leveled when the slope of the first 5
|
||||
* bits is applied. This means that there can only be one leveled
|
||||
* slope for steep slopes, which is logical because two leveled
|
||||
* slopes would mean that it is not a steep slope as halftile
|
||||
* slopes only span one height level.
|
||||
*/
|
||||
enum Slope {
|
||||
SLOPE_FLAT = 0x00, ///< a flat tile
|
||||
SLOPE_W = 0x01, ///< the west corner of the tile is raised
|
||||
SLOPE_S = 0x02, ///< the south corner of the tile is raised
|
||||
SLOPE_E = 0x04, ///< the east corner of the tile is raised
|
||||
SLOPE_N = 0x08, ///< the north corner of the tile is raised
|
||||
SLOPE_STEEP = 0x10, ///< indicates the slope is steep
|
||||
SLOPE_NW = SLOPE_N | SLOPE_W, ///< north and west corner are raised
|
||||
SLOPE_SW = SLOPE_S | SLOPE_W, ///< south and west corner are raised
|
||||
SLOPE_SE = SLOPE_S | SLOPE_E, ///< south and east corner are raised
|
||||
SLOPE_NE = SLOPE_N | SLOPE_E, ///< north and east corner are raised
|
||||
SLOPE_EW = SLOPE_E | SLOPE_W, ///< east and west corner are raised
|
||||
SLOPE_NS = SLOPE_N | SLOPE_S, ///< north and south corner are raised
|
||||
SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W, ///< all corner are raised, similar to SLOPE_FLAT
|
||||
SLOPE_NWS = SLOPE_N | SLOPE_W | SLOPE_S, ///< north, west and south corner are raised
|
||||
SLOPE_WSE = SLOPE_W | SLOPE_S | SLOPE_E, ///< west, south and east corner are raised
|
||||
SLOPE_SEN = SLOPE_S | SLOPE_E | SLOPE_N, ///< south, east and north corner are raised
|
||||
SLOPE_ENW = SLOPE_E | SLOPE_N | SLOPE_W, ///< east, north and west corner are raised
|
||||
SLOPE_STEEP_W = SLOPE_STEEP | SLOPE_NWS, ///< a steep slope falling to east (from west)
|
||||
SLOPE_STEEP_S = SLOPE_STEEP | SLOPE_WSE, ///< a steep slope falling to north (from south)
|
||||
SLOPE_STEEP_E = SLOPE_STEEP | SLOPE_SEN, ///< a steep slope falling to west (from east)
|
||||
SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW, ///< a steep slope falling to south (from north)
|
||||
|
||||
SLOPE_HALFTILE = 0x20, ///< one halftile is leveled (non continuous slope)
|
||||
SLOPE_HALFTILE_MASK = 0xE0, ///< three bits used for halftile slopes
|
||||
SLOPE_HALFTILE_W = SLOPE_HALFTILE | (CORNER_W << 6), ///< the west halftile is leveled (non continuous slope)
|
||||
SLOPE_HALFTILE_S = SLOPE_HALFTILE | (CORNER_S << 6), ///< the south halftile is leveled (non continuous slope)
|
||||
SLOPE_HALFTILE_E = SLOPE_HALFTILE | (CORNER_E << 6), ///< the east halftile is leveled (non continuous slope)
|
||||
SLOPE_HALFTILE_N = SLOPE_HALFTILE | (CORNER_N << 6), ///< the north halftile is leveled (non continuous slope)
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Enumeration for Foundations.
|
||||
*/
|
||||
enum Foundation {
|
||||
FOUNDATION_NONE, ///< The tile has no foundation, the slope remains unchanged.
|
||||
FOUNDATION_LEVELED, ///< The tile is leveled up to a flat slope.
|
||||
FOUNDATION_INCLINED_X, ///< The tile has an along X-axis inclined foundation.
|
||||
FOUNDATION_INCLINED_Y, ///< The tile has an along Y-axis inclined foundation.
|
||||
FOUNDATION_STEEP_LOWER, ///< The tile has a steep slope. The lowest corner is raised by a foundation to allow building railroad on the lower halftile.
|
||||
|
||||
/* Halftile foundations */
|
||||
FOUNDATION_STEEP_BOTH, ///< The tile has a steep slope. The lowest corner is raised by a foundation and the upper halftile is leveled.
|
||||
FOUNDATION_HALFTILE_W, ///< Level west halftile non-continuously.
|
||||
FOUNDATION_HALFTILE_S, ///< Level south halftile non-continuously.
|
||||
FOUNDATION_HALFTILE_E, ///< Level east halftile non-continuously.
|
||||
FOUNDATION_HALFTILE_N, ///< Level north halftile non-continuously.
|
||||
|
||||
/* Special anti-zig-zag foundations for single horizontal/vertical track */
|
||||
FOUNDATION_RAIL_W, ///< Foundation for TRACK_BIT_LEFT, but not a leveled foundation.
|
||||
FOUNDATION_RAIL_S, ///< Foundation for TRACK_BIT_LOWER, but not a leveled foundation.
|
||||
FOUNDATION_RAIL_E, ///< Foundation for TRACK_BIT_RIGHT, but not a leveled foundation.
|
||||
FOUNDATION_RAIL_N, ///< Foundation for TRACK_BIT_UPPER, but not a leveled foundation.
|
||||
|
||||
FOUNDATION_INVALID = 0xFF ///< Used inside "rail_cmd.cpp" to indicate invalid slope/track combination.
|
||||
};
|
||||
|
||||
#endif /* SLOPE_TYPE_H */
|
@ -0,0 +1,54 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file tile_type.h Types related to tiles. */
|
||||
|
||||
#ifndef TILE_TYPE_H
|
||||
#define TILE_TYPE_H
|
||||
|
||||
#include "core/enum_type.hpp"
|
||||
|
||||
/** Maximum allowed tile height */
|
||||
#define MAX_TILE_HEIGHT 15
|
||||
|
||||
/** Maximum allowed snowline height */
|
||||
#define MAX_SNOWLINE_HEIGHT (MAX_TILE_HEIGHT - 2)
|
||||
|
||||
/**
|
||||
* The different type of a tile.
|
||||
*
|
||||
* Each tile belongs to one type, according whatever is build on it.
|
||||
*
|
||||
* @note A railway with a crossing street is marked as MP_ROAD.
|
||||
*/
|
||||
enum TileType {
|
||||
MP_CLEAR, ///< A tile without any structures, i.e. grass, rocks, farm fields etc.
|
||||
MP_RAILWAY, ///< A railway
|
||||
MP_ROAD, ///< A tile with road (or tram tracks)
|
||||
MP_HOUSE, ///< A house by a town
|
||||
MP_TREES, ///< Tile got trees
|
||||
MP_STATION, ///< A tile of a station
|
||||
MP_WATER, ///< Water tile
|
||||
MP_VOID, ///< Invisible tiles at the SW and SE border
|
||||
MP_INDUSTRY, ///< Part of an industry
|
||||
MP_TUNNELBRIDGE, ///< Tunnel entry/exit and bridge heads
|
||||
MP_UNMOVABLE, ///< Contains an object with cannot be removed like transmitters
|
||||
};
|
||||
|
||||
/**
|
||||
* Additional infos of a tile on a tropic game.
|
||||
*
|
||||
* Each non-water tile in a tropic game is either a rainforest tile or a
|
||||
* desert one.
|
||||
*/
|
||||
enum TropicZone {
|
||||
TROPICZONE_INVALID = 0, ///< Invalid tropiczone-type
|
||||
TROPICZONE_DESERT = 1, ///< Tile is desert
|
||||
TROPICZONE_RAINFOREST = 2, ///< Rainforest tile
|
||||
};
|
||||
|
||||
/**
|
||||
* The index/ID of a Tile.
|
||||
*/
|
||||
typedef uint32 TileIndex;
|
||||
|
||||
#endif /* TILE_TYPE_H */
|
@ -0,0 +1,28 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file vehicle_type.h Types related to vehicles. */
|
||||
|
||||
#ifndef VEHICLE_TYPE_H
|
||||
#define VEHICLE_TYPE_H
|
||||
|
||||
#include "core/enum_type.hpp"
|
||||
|
||||
typedef uint16 VehicleID;
|
||||
|
||||
enum VehicleType {
|
||||
VEH_TRAIN,
|
||||
VEH_ROAD,
|
||||
VEH_SHIP,
|
||||
VEH_AIRCRAFT,
|
||||
VEH_SPECIAL,
|
||||
VEH_DISASTER,
|
||||
VEH_END,
|
||||
VEH_INVALID = 0xFF,
|
||||
};
|
||||
DECLARE_POSTFIX_INCREMENT(VehicleType);
|
||||
template <> struct EnumPropsT<VehicleType> : MakeEnumPropsT<VehicleType, byte, VEH_TRAIN, VEH_END, VEH_INVALID> {};
|
||||
typedef TinyEnumT<VehicleType> VehicleTypeByte;
|
||||
|
||||
struct Vehicle;
|
||||
|
||||
#endif /* VEHICLE_TYPE_H */
|
Loading…
Reference in New Issue