OpenTTD Source
20241125-master-g5b02f51e17
|
Definitions of a slope. More...
#include "core/enum_type.hpp"
Go to the source code of this file.
Macros | |
#define | M(x) (1U << (x)) |
Helper for creating a bitset of slopes. More... | |
Enumerations | |
enum | Corner { CORNER_W = 0 , CORNER_S = 1 , CORNER_E = 2 , CORNER_N = 3 , CORNER_END , CORNER_INVALID = 0xFF } |
Enumeration of tile corners. | |
enum | Slope : uint8_t { SLOPE_FLAT = 0x00 , SLOPE_W = 0x01 , SLOPE_S = 0x02 , SLOPE_E = 0x04 , SLOPE_N = 0x08 , SLOPE_STEEP = 0x10 , SLOPE_NW = SLOPE_N | SLOPE_W , SLOPE_SW = SLOPE_S | SLOPE_W , SLOPE_SE = SLOPE_S | SLOPE_E , SLOPE_NE = SLOPE_N | SLOPE_E , SLOPE_EW = SLOPE_E | SLOPE_W , SLOPE_NS = SLOPE_N | SLOPE_S , SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W , SLOPE_NWS = SLOPE_N | SLOPE_W | SLOPE_S , SLOPE_WSE = SLOPE_W | SLOPE_S | SLOPE_E , SLOPE_SEN = SLOPE_S | SLOPE_E | SLOPE_N , SLOPE_ENW = SLOPE_E | SLOPE_N | SLOPE_W , SLOPE_STEEP_W = SLOPE_STEEP | SLOPE_NWS , SLOPE_STEEP_S = SLOPE_STEEP | SLOPE_WSE , SLOPE_STEEP_E = SLOPE_STEEP | SLOPE_SEN , SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW , SLOPE_HALFTILE = 0x20 , SLOPE_HALFTILE_MASK = 0xE0 , SLOPE_HALFTILE_W = SLOPE_HALFTILE | (CORNER_W << 6) , SLOPE_HALFTILE_S = SLOPE_HALFTILE | (CORNER_S << 6) , SLOPE_HALFTILE_E = SLOPE_HALFTILE | (CORNER_E << 6) , SLOPE_HALFTILE_N = SLOPE_HALFTILE | (CORNER_N << 6) } |
Enumeration for the slope-type. More... | |
enum | Foundation { FOUNDATION_NONE , FOUNDATION_LEVELED , FOUNDATION_INCLINED_X , FOUNDATION_INCLINED_Y , FOUNDATION_STEEP_LOWER , FOUNDATION_STEEP_BOTH , FOUNDATION_HALFTILE_W , FOUNDATION_HALFTILE_S , FOUNDATION_HALFTILE_E , FOUNDATION_HALFTILE_N , FOUNDATION_RAIL_W , FOUNDATION_RAIL_S , FOUNDATION_RAIL_E , FOUNDATION_RAIL_N , FOUNDATION_INVALID = 0xFF } |
Enumeration for Foundations. More... | |
Variables | |
static const uint32_t | VALID_LEVEL_CROSSING_SLOPES = M(SLOPE_SEN) | M(SLOPE_ENW) | M(SLOPE_NWS) | M(SLOPE_NS) | M(SLOPE_WSE) | M(SLOPE_EW) | M(SLOPE_FLAT) |
Constant bitset with safe slopes for building a level crossing. | |
Definitions of a slope.
This file defines the enumeration and helper functions for handling the slope info of a tile.
Definition in file slope_type.h.
#define M | ( | x | ) | (1U << (x)) |
Helper for creating a bitset of slopes.
x | The slope to convert into a bitset. |
Definition at line 84 of file slope_type.h.
enum Foundation |
Enumeration for Foundations.
Definition at line 93 of file slope_type.h.
enum Slope : uint8_t |
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.
Definition at line 48 of file slope_type.h.