# landscape.h

Go to the documentation of this file.

    00001 /* $Id: landscape.h 18809 2010-01-15 16:41:15Z rubidium $ */
    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
    00018 enum {
    00019   SNOW_LINE_MONTHS = 12,
    00020   SNOW_LINE_DAYS   = 32,
    00021 };
    00022
    00025 struct SnowLine {
    00026   byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS];
    00027   byte highest_value;
    00028   byte lowest_value;
    00029 };
    00030
    00031 bool IsSnowLineSet();
    00032 void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]);
    00033 byte GetSnowLine();
    00034 byte HighestSnowLine();
    00035 byte LowestSnowLine();
    00036 void ClearSnowLine();
    00037
    00038 uint GetPartialZ(int x, int y, Slope corners);
    00039 uint GetSlopeZ(int x, int y);
    00040 void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2);
    00041 int GetSlopeZInCorner(Slope tileh, Corner corner);
    00042 Slope GetFoundationSlope(TileIndex tile, uint *z);
    00043
    00044 static inline Point RemapCoords(int x, int y, int z)
    00045 {
    00046   Point pt;
    00047   pt.x = (y - x) * 2;
    00048   pt.y = y + x - z;
    00049   return pt;
    00050 }
    00051
    00052 static inline Point RemapCoords2(int x, int y)
    00053 {
    00054   return RemapCoords(x, y, GetSlopeZ(x, y));
    00055 }
    00056
    00057 uint ApplyFoundationToSlope(Foundation f, Slope *s);
    00058 void DrawFoundation(TileInfo *ti, Foundation f);
    00059 bool HasFoundationNW(TileIndex tile, Slope slope_here, uint z_here);
    00060 bool HasFoundationNE(TileIndex tile, Slope slope_here, uint z_here);
    00061
    00062 void DoClearSquare(TileIndex tile);
    00063 void RunTileLoop();
    00064
    00065 void InitializeLandscape();
    00066 void GenerateLandscape(byte mode);
    00067
    00068 #endif /* LANDSCAPE_H */