tron@3636: /* $Id$ */ tron@3636: rubidium@8604: /** rubidium@8604: * @file slope_type.h Definitions of a slope. truelight@7805: * This file defines the enumeration and helper functions for handling truelight@7805: * the slope info of a tile. truelight@7805: */ belugas@6916: rubidium@8604: #ifndef SLOPE_TYPE_H rubidium@8604: #define SLOPE_TYPE_H rubidium@8604: rubidium@8604: #include "core/enum_type.hpp" tron@3636: truelight@7805: /** rubidium@8260: * Enumeration of tile corners rubidium@8260: */ rubidium@8260: enum Corner { rubidium@8260: CORNER_W = 0, rubidium@8260: CORNER_S = 1, rubidium@8260: CORNER_E = 2, rubidium@8260: CORNER_N = 3, rubidium@8266: CORNER_END, rubidium@8266: CORNER_INVALID = 0xFF rubidium@8260: }; rubidium@8260: rubidium@8604: rubidium@8260: /** truelight@7805: * Enumeration for the slope-type. truelight@7805: * truelight@7805: * This enumeration use the chars N,E,S,W corresponding the truelight@7805: * direction north, east, south and west. The top corner of a tile truelight@7805: * is the north-part of the tile. The whole slope is encoded with truelight@7805: * 5 bits, 4 bits for each corner and 1 bit for a steep-flag. rubidium@8260: * rubidium@8260: * For halftile slopes an extra 3 bits are used to represent this rubidium@8260: * properly; 1 bit for a halftile-flag and 2 bits to encode which rubidium@8260: * extra side (corner) is leveled when the slope of the first 5 rubidium@8260: * bits is applied. This means that there can only be one leveled rubidium@8260: * slope for steep slopes, which is logical because two leveled rubidium@8260: * slopes would mean that it is not a steep slope as halftile rubidium@8260: * slopes only span one height level. truelight@7805: */ rubidium@6574: enum Slope { truelight@7805: SLOPE_FLAT = 0x00, ///< a flat tile truelight@7805: SLOPE_W = 0x01, ///< the west corner of the tile is raised truelight@7805: SLOPE_S = 0x02, ///< the south corner of the tile is raised truelight@7805: SLOPE_E = 0x04, ///< the east corner of the tile is raised truelight@7805: SLOPE_N = 0x08, ///< the north corner of the tile is raised truelight@7805: SLOPE_STEEP = 0x10, ///< indicates the slope is steep truelight@7805: SLOPE_NW = SLOPE_N | SLOPE_W, ///< north and west corner are raised truelight@7805: SLOPE_SW = SLOPE_S | SLOPE_W, ///< south and west corner are raised truelight@7805: SLOPE_SE = SLOPE_S | SLOPE_E, ///< south and east corner are raised truelight@7805: SLOPE_NE = SLOPE_N | SLOPE_E, ///< north and east corner are raised truelight@7805: SLOPE_EW = SLOPE_E | SLOPE_W, ///< east and west corner are raised truelight@7805: SLOPE_NS = SLOPE_N | SLOPE_S, ///< north and south corner are raised truelight@7805: SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W, ///< all corner are raised, similar to SLOPE_FLAT truelight@7805: SLOPE_NWS = SLOPE_N | SLOPE_W | SLOPE_S, ///< north, west and south corner are raised truelight@7805: SLOPE_WSE = SLOPE_W | SLOPE_S | SLOPE_E, ///< west, south and east corner are raised truelight@7805: SLOPE_SEN = SLOPE_S | SLOPE_E | SLOPE_N, ///< south, east and north corner are raised truelight@7805: SLOPE_ENW = SLOPE_E | SLOPE_N | SLOPE_W, ///< east, north and west corner are raised truelight@7805: SLOPE_STEEP_W = SLOPE_STEEP | SLOPE_NWS, ///< a steep slope falling to east (from west) truelight@7805: SLOPE_STEEP_S = SLOPE_STEEP | SLOPE_WSE, ///< a steep slope falling to north (from south) truelight@7805: SLOPE_STEEP_E = SLOPE_STEEP | SLOPE_SEN, ///< a steep slope falling to west (from east) rubidium@8260: SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW, ///< a steep slope falling to south (from north) tron@3636: rubidium@8260: SLOPE_HALFTILE = 0x20, ///< one halftile is leveled (non continuous slope) rubidium@8260: SLOPE_HALFTILE_MASK = 0xE0, ///< three bits used for halftile slopes rubidium@8260: SLOPE_HALFTILE_W = SLOPE_HALFTILE | (CORNER_W << 6), ///< the west halftile is leveled (non continuous slope) rubidium@8260: SLOPE_HALFTILE_S = SLOPE_HALFTILE | (CORNER_S << 6), ///< the south halftile is leveled (non continuous slope) rubidium@8260: SLOPE_HALFTILE_E = SLOPE_HALFTILE | (CORNER_E << 6), ///< the east halftile is leveled (non continuous slope) rubidium@8260: SLOPE_HALFTILE_N = SLOPE_HALFTILE | (CORNER_N << 6), ///< the north halftile is leveled (non continuous slope) rubidium@8174: }; frosch@9297: DECLARE_ENUM_AS_BIT_SET(Slope) rubidium@8174: rubidium@7831: rubidium@7831: /** rubidium@7831: * Enumeration for Foundations. rubidium@7831: */ rubidium@7831: enum Foundation { rubidium@7831: FOUNDATION_NONE, ///< The tile has no foundation, the slope remains unchanged. rubidium@7831: FOUNDATION_LEVELED, ///< The tile is leveled up to a flat slope. rubidium@7831: FOUNDATION_INCLINED_X, ///< The tile has an along X-axis inclined foundation. rubidium@7831: FOUNDATION_INCLINED_Y, ///< The tile has an along Y-axis inclined foundation. rubidium@8266: 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. rubidium@8266: rubidium@8604: /* Halftile foundations */ rubidium@8266: FOUNDATION_STEEP_BOTH, ///< The tile has a steep slope. The lowest corner is raised by a foundation and the upper halftile is leveled. rubidium@8266: FOUNDATION_HALFTILE_W, ///< Level west halftile non-continuously. rubidium@8266: FOUNDATION_HALFTILE_S, ///< Level south halftile non-continuously. rubidium@8266: FOUNDATION_HALFTILE_E, ///< Level east halftile non-continuously. rubidium@8266: FOUNDATION_HALFTILE_N, ///< Level north halftile non-continuously. rubidium@8266: rubidium@8604: /* Special anti-zig-zag foundations for single horizontal/vertical track */ rubidium@8266: FOUNDATION_RAIL_W, ///< Foundation for TRACK_BIT_LEFT, but not a leveled foundation. rubidium@8266: FOUNDATION_RAIL_S, ///< Foundation for TRACK_BIT_LOWER, but not a leveled foundation. rubidium@8266: FOUNDATION_RAIL_E, ///< Foundation for TRACK_BIT_RIGHT, but not a leveled foundation. rubidium@8266: FOUNDATION_RAIL_N, ///< Foundation for TRACK_BIT_UPPER, but not a leveled foundation. rubidium@8199: rubidium@8199: FOUNDATION_INVALID = 0xFF ///< Used inside "rail_cmd.cpp" to indicate invalid slope/track combination. rubidium@7831: }; rubidium@7831: rubidium@8604: #endif /* SLOPE_TYPE_H */