src/landscape.h
author skidd13
Tue, 20 Nov 2007 14:11:19 +0000
changeset 8428 f8300c908bd9
parent 8266 48fa6a084b98
child 8615 6b91ca653bad
child 9723 eee46cb39750
permissions -rw-r--r--
(svn r11485) -Codechange: Remove the doubled function ToggleBitT and rename the remaining to fit with the naming style
6669
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
     1
/* $Id$ */
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
     2
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
     3
/** @file landscape.h */
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
     4
6949
72d11a1e1e60 (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: 6669
diff changeset
     5
#ifndef LANDSCAPE_H
72d11a1e1e60 (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: 6669
diff changeset
     6
#define LANDSCAPE_H
72d11a1e1e60 (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: 6669
diff changeset
     7
6669
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
     8
enum {
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
     9
	SNOW_LINE_MONTHS = 12,
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    10
	SNOW_LINE_DAYS   = 32,
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    11
};
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    12
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    13
struct SnowLine {
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    14
	byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS];
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    15
	byte highest_value;
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    16
};
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    17
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    18
bool IsSnowLineSet(void);
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    19
void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]);
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    20
byte GetSnowLine(void);
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    21
byte HighestSnowLine(void);
487ac09b95c4 (svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
maedhros
parents:
diff changeset
    22
void ClearSnowLine(void);
6949
72d11a1e1e60 (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: 6669
diff changeset
    23
72d11a1e1e60 (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: 6669
diff changeset
    24
bool IsValidTile(TileIndex tile);
72d11a1e1e60 (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: 6669
diff changeset
    25
72d11a1e1e60 (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: 6669
diff changeset
    26
uint GetPartialZ(int x, int y, Slope corners);
72d11a1e1e60 (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: 6669
diff changeset
    27
uint GetSlopeZ(int x, int y);
8224
6260e98d1c6a (svn r11263) -Codechange: Reduce code duplication between DrawBridgePillars and HasFoundation{NW|NE}. Patch by frosch.
rubidium
parents: 7831
diff changeset
    28
void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2);
8266
48fa6a084b98 (svn r11319) -Add: halftile- and anti-zig-zag-foundations. Patch by frosch.
rubidium
parents: 8224
diff changeset
    29
int GetSlopeZInCorner(Slope tileh, Corner corner);
6949
72d11a1e1e60 (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: 6669
diff changeset
    30
72d11a1e1e60 (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: 6669
diff changeset
    31
static inline Point RemapCoords(int x, int y, int z)
72d11a1e1e60 (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: 6669
diff changeset
    32
{
72d11a1e1e60 (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: 6669
diff changeset
    33
	Point pt;
72d11a1e1e60 (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: 6669
diff changeset
    34
	pt.x = (y - x) * 2;
72d11a1e1e60 (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: 6669
diff changeset
    35
	pt.y = y + x - z;
72d11a1e1e60 (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: 6669
diff changeset
    36
	return pt;
72d11a1e1e60 (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: 6669
diff changeset
    37
}
72d11a1e1e60 (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: 6669
diff changeset
    38
72d11a1e1e60 (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: 6669
diff changeset
    39
static inline Point RemapCoords2(int x, int y)
72d11a1e1e60 (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: 6669
diff changeset
    40
{
72d11a1e1e60 (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: 6669
diff changeset
    41
	return RemapCoords(x, y, GetSlopeZ(x, y));
72d11a1e1e60 (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: 6669
diff changeset
    42
}
72d11a1e1e60 (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: 6669
diff changeset
    43
7831
5dded9b03500 (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: 7179
diff changeset
    44
uint ApplyFoundationToSlope(Foundation f, Slope *s);
5dded9b03500 (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: 7179
diff changeset
    45
void DrawFoundation(TileInfo *ti, Foundation f);
6949
72d11a1e1e60 (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: 6669
diff changeset
    46
72d11a1e1e60 (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: 6669
diff changeset
    47
void DoClearSquare(TileIndex tile);
72d11a1e1e60 (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: 6669
diff changeset
    48
void RunTileLoop();
72d11a1e1e60 (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: 6669
diff changeset
    49
7179
3e123c2b7c93 (svn r9914) -Codechange: prepare GTTS and the pathfinders to handle multiple road types on a single tile.
rubidium
parents: 6949
diff changeset
    50
uint32 GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode);
6949
72d11a1e1e60 (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: 6669
diff changeset
    51
void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
72d11a1e1e60 (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: 6669
diff changeset
    52
void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player);
72d11a1e1e60 (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: 6669
diff changeset
    53
void AnimateTile(TileIndex tile);
72d11a1e1e60 (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: 6669
diff changeset
    54
void ClickTile(TileIndex tile);
72d11a1e1e60 (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: 6669
diff changeset
    55
void GetTileDesc(TileIndex tile, TileDesc *td);
72d11a1e1e60 (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: 6669
diff changeset
    56
72d11a1e1e60 (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: 6669
diff changeset
    57
void InitializeLandscape();
72d11a1e1e60 (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: 6669
diff changeset
    58
void GenerateLandscape(byte mode);
72d11a1e1e60 (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: 6669
diff changeset
    59
72d11a1e1e60 (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: 6669
diff changeset
    60
void ConvertGroundTilesIntoWaterTiles();
72d11a1e1e60 (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: 6669
diff changeset
    61
72d11a1e1e60 (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: 6669
diff changeset
    62
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng);
72d11a1e1e60 (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: 6669
diff changeset
    63
72d11a1e1e60 (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: 6669
diff changeset
    64
#endif /* LANDSCAPE_H */