src/landscape.h
author rubidium
Wed, 17 Dec 2008 23:08:11 +0000
changeset 10434 3659467c844c
parent 10260 c6ec6b3c1b18
permissions -rw-r--r--
(svn r14687) -Change: log all configure errors to config.log
6343
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
     1
/* $Id$ */
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
     2
9111
48ce04029fe4 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 8651
diff changeset
     3
/** @file landscape.h Functions related to OTTD's landscape. */
6343
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
     4
6453
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
     5
#ifndef LANDSCAPE_H
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
     6
#define LANDSCAPE_H
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
     7
8121
3bc6351e7369 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8119
diff changeset
     8
#include "core/geometry_type.hpp"
8138
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8121
diff changeset
     9
#include "tile_cmd.h"
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8121
diff changeset
    10
#include "slope_type.h"
dbfdc08fa6b9 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents: 8121
diff changeset
    11
#include "direction_type.h"
8119
52b48108425a (svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents: 7770
diff changeset
    12
6343
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    13
enum {
10260
c6ec6b3c1b18 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium
parents: 9111
diff changeset
    14
	SNOW_LINE_MONTHS = 12, ///< Number of months in the snow line table.
c6ec6b3c1b18 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium
parents: 9111
diff changeset
    15
	SNOW_LINE_DAYS   = 32, ///< Number of days in each month in the snow line table.
6343
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    16
};
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    17
10260
c6ec6b3c1b18 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium
parents: 9111
diff changeset
    18
/** Structure describing the height of the snow line each day of the year
c6ec6b3c1b18 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium
parents: 9111
diff changeset
    19
 * @ingroup SnowLineGroup */
6343
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    20
struct SnowLine {
10260
c6ec6b3c1b18 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium
parents: 9111
diff changeset
    21
	byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]; ///< Height of the snow line each day of the year
c6ec6b3c1b18 (svn r14491) -Documentation: updates/additions of doxygen docs (Alberth)
rubidium
parents: 9111
diff changeset
    22
	byte highest_value; ///< Highest snow line of the year
6343
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    23
};
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    24
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    25
bool IsSnowLineSet(void);
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    26
void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]);
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    27
byte GetSnowLine(void);
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    28
byte HighestSnowLine(void);
76d17f784c13 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    29
void ClearSnowLine(void);
6453
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    30
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    31
uint GetPartialZ(int x, int y, Slope corners);
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    32
uint GetSlopeZ(int x, int y);
7728
68e794385dc9 (svn r11263) -Codechange: Reduce code duplication between DrawBridgePillars and HasFoundation{NW|NE}. Patch by frosch.
rubidium
parents: 7335
diff changeset
    33
void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2);
7770
320d260ff1a1 (svn r11319) -Add: halftile- and anti-zig-zag-foundations. Patch by frosch.
rubidium
parents: 7728
diff changeset
    34
int GetSlopeZInCorner(Slope tileh, Corner corner);
8380
174326093caa (svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents: 8138
diff changeset
    35
Slope GetFoundationSlope(TileIndex tile, uint* z);
6453
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    36
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    37
static inline Point RemapCoords(int x, int y, int z)
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    38
{
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    39
	Point pt;
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    40
	pt.x = (y - x) * 2;
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    41
	pt.y = y + x - z;
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    42
	return pt;
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    43
}
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    44
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    45
static inline Point RemapCoords2(int x, int y)
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    46
{
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    47
	return RemapCoords(x, y, GetSlopeZ(x, y));
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    48
}
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    49
7335
141c6b86ec1f (svn r10698) -Codechange [FS#1082]: simplify the code related to foundations. Primarily removal of (duplicated|magic) code and introduction of few helper functions to ease foundation determination. Patch by frosch.
rubidium
parents: 6683
diff changeset
    50
uint ApplyFoundationToSlope(Foundation f, Slope *s);
141c6b86ec1f (svn r10698) -Codechange [FS#1082]: simplify the code related to foundations. Primarily removal of (duplicated|magic) code and introduction of few helper functions to ease foundation determination. Patch by frosch.
rubidium
parents: 6683
diff changeset
    51
void DrawFoundation(TileInfo *ti, Foundation f);
6453
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    52
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    53
void DoClearSquare(TileIndex tile);
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    54
void RunTileLoop();
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    55
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    56
void InitializeLandscape();
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    57
void GenerateLandscape(byte mode);
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    58
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    59
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng);
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    60
226bcddeba32 (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents: 6343
diff changeset
    61
#endif /* LANDSCAPE_H */