# landscape.h

Go to the documentation of this file.

    00001 /* $Id: landscape.h 12303 2008-02-28 00:10:08Z glx $ */
    00002
    00005 #ifndef LANDSCAPE_H
    00006 #define LANDSCAPE_H
    00007
    00008 #include "core/geometry_type.hpp"
    00009 #include "tile_cmd.h"
    00010 #include "slope_type.h"
    00011 #include "direction_type.h"
    00012
    00013 enum {
    00014   SNOW_LINE_MONTHS = 12,
    00015   SNOW_LINE_DAYS   = 32,
    00016 };
    00017
    00018 struct SnowLine {
    00019   byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS];
    00020   byte highest_value;
    00021 };
    00022
    00023 bool IsSnowLineSet(void);
    00024 void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]);
    00025 byte GetSnowLine(void);
    00026 byte HighestSnowLine(void);
    00027 void ClearSnowLine(void);
    00028
    00029 uint GetPartialZ(int x, int y, Slope corners);
    00030 uint GetSlopeZ(int x, int y);
    00031 void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2);
    00032 int GetSlopeZInCorner(Slope tileh, Corner corner);
    00033 Slope GetFoundationSlope(TileIndex tile, uint* z);
    00034
    00035 static inline Point RemapCoords(int x, int y, int z)
    00036 {
    00037   Point pt;
    00038   pt.x = (y - x) * 2;
    00039   pt.y = y + x - z;
    00040   return pt;
    00041 }
    00042
    00043 static inline Point RemapCoords2(int x, int y)
    00044 {
    00045   return RemapCoords(x, y, GetSlopeZ(x, y));
    00046 }
    00047
    00048 uint ApplyFoundationToSlope(Foundation f, Slope *s);
    00049 void DrawFoundation(TileInfo *ti, Foundation f);
    00050
    00051 void DoClearSquare(TileIndex tile);
    00052 void RunTileLoop();
    00053
    00054 void InitializeLandscape();
    00055 void GenerateLandscape(byte mode);
    00056
    00057 TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng);
    00058
    00059 #endif /* LANDSCAPE_H */