# slope_type.h

Go to the documentation of this file.

    00001 /* $Id$ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00016 #ifndef SLOPE_TYPE_H
    00017 #define SLOPE_TYPE_H
    00018
    00019 #include "core/enum_type.hpp"
    00020
    00024 enum Corner {
    00025   CORNER_W = 0,
    00026   CORNER_S = 1,
    00027   CORNER_E = 2,
    00028   CORNER_N = 3,
    00029   CORNER_END,
    00030   CORNER_INVALID = 0xFF
    00031 };
    00032
    00033
    00050 enum Slope {
    00051   SLOPE_FLAT     = 0x00,
    00052   SLOPE_W        = 0x01,
    00053   SLOPE_S        = 0x02,
    00054   SLOPE_E        = 0x04,
    00055   SLOPE_N        = 0x08,
    00056   SLOPE_STEEP    = 0x10,
    00057   SLOPE_NW       = SLOPE_N | SLOPE_W,
    00058   SLOPE_SW       = SLOPE_S | SLOPE_W,
    00059   SLOPE_SE       = SLOPE_S | SLOPE_E,
    00060   SLOPE_NE       = SLOPE_N | SLOPE_E,
    00061   SLOPE_EW       = SLOPE_E | SLOPE_W,
    00062   SLOPE_NS       = SLOPE_N | SLOPE_S,
    00063   SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W,
    00064   SLOPE_NWS      = SLOPE_N | SLOPE_W | SLOPE_S,
    00065   SLOPE_WSE      = SLOPE_W | SLOPE_S | SLOPE_E,
    00066   SLOPE_SEN      = SLOPE_S | SLOPE_E | SLOPE_N,
    00067   SLOPE_ENW      = SLOPE_E | SLOPE_N | SLOPE_W,
    00068   SLOPE_STEEP_W  = SLOPE_STEEP | SLOPE_NWS,
    00069   SLOPE_STEEP_S  = SLOPE_STEEP | SLOPE_WSE,
    00070   SLOPE_STEEP_E  = SLOPE_STEEP | SLOPE_SEN,
    00071   SLOPE_STEEP_N  = SLOPE_STEEP | SLOPE_ENW,
    00072
    00073   SLOPE_HALFTILE = 0x20,
    00074   SLOPE_HALFTILE_MASK = 0xE0,
    00075   SLOPE_HALFTILE_W = SLOPE_HALFTILE | (CORNER_W << 6),
    00076   SLOPE_HALFTILE_S = SLOPE_HALFTILE | (CORNER_S << 6),
    00077   SLOPE_HALFTILE_E = SLOPE_HALFTILE | (CORNER_E << 6),
    00078   SLOPE_HALFTILE_N = SLOPE_HALFTILE | (CORNER_N << 6),
    00079 };
    00080 DECLARE_ENUM_AS_BIT_SET(Slope)
    00081
    00082 #define M(x) (1 << (x))
    00083
    00084 static const uint32 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);
    00085 #undef M
    00086
    00087
    00091 enum Foundation {
    00092   FOUNDATION_NONE,
    00093   FOUNDATION_LEVELED,
    00094   FOUNDATION_INCLINED_X,
    00095   FOUNDATION_INCLINED_Y,
    00096   FOUNDATION_STEEP_LOWER,
    00097
    00098   /* Halftile foundations */
    00099   FOUNDATION_STEEP_BOTH,
    00100   FOUNDATION_HALFTILE_W,
    00101   FOUNDATION_HALFTILE_S,
    00102   FOUNDATION_HALFTILE_E,
    00103   FOUNDATION_HALFTILE_N,
    00104
    00105   /* Special anti-zig-zag foundations for single horizontal/vertical track */
    00106   FOUNDATION_RAIL_W,
    00107   FOUNDATION_RAIL_S,
    00108   FOUNDATION_RAIL_E,
    00109   FOUNDATION_RAIL_N,
    00110
    00111   FOUNDATION_INVALID = 0xFF
    00112 };
    00113
    00114 #endif /* SLOPE_TYPE_H */