# landscape.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
    00012 #ifndef LANDSCAPE_H
    00013 #define LANDSCAPE_H
    00014
    00015 #include "core/geometry_type.hpp"
    00016 #include "tile_cmd.h"
    00017 #include "slope_type.h"
    00018 #include "direction_type.h"
    00019
    00020 enum {
    00021   SNOW_LINE_MONTHS = 12,
    00022   SNOW_LINE_DAYS   = 32,
    00023 };
    00024
    00027 struct SnowLine {
    00028   byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS];
    00029   byte highest_value;
    00030   byte lowest_value;
    00031 };
    00032
    00033 bool IsSnowLineSet();
    00034 void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]);
    00035 byte GetSnowLine();
    00036 byte HighestSnowLine();
    00037 byte LowestSnowLine();
    00038 void ClearSnowLine();
    00039
    00040 uint GetPartialZ(int x, int y, Slope corners);
    00041 uint GetSlopeZ(int x, int y);
    00042 void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2);
    00043 int GetSlopeZInCorner(Slope tileh, Corner corner);
    00044 Slope GetFoundationSlope(TileIndex tile, uint *z);
    00045
    00046 static inline Point RemapCoords(int x, int y, int z)
    00047 {
    00048   Point pt;
    00049   pt.x = (y - x) * 2;
    00050   pt.y = y + x - z;
    00051   return pt;
    00052 }
    00053
    00054 static inline Point RemapCoords2(int x, int y)
    00055 {
    00056   return RemapCoords(x, y, GetSlopeZ(x, y));
    00057 }
    00058
    00059 uint ApplyFoundationToSlope(Foundation f, Slope *s);
    00060 void DrawFoundation(TileInfo *ti, Foundation f);
    00061
    00062 void DoClearSquare(TileIndex tile);
    00063 void RunTileLoop();
    00064
    00065 void InitializeLandscape();
    00066 void GenerateLandscape(byte mode);
    00067
    00068 #endif /* LANDSCAPE_H */