src/landscape.h
author richk
Fri, 03 Aug 2007 18:10:15 +0000
branchNewGRF_ports
changeset 6743 cabfaa4a0295
parent 6719 4cc327ad39d5
child 6871 5a9dc001e1ad
permissions -rw-r--r--
(svn r10766) [NewGRF_ports] -Sync: with trunk r10651-10765
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
6719
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
     5
#ifndef LANDSCAPE_H
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
     6
#define LANDSCAPE_H
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
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);
6719
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    23
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    24
bool IsValidTile(TileIndex tile);
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    25
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    26
uint GetPartialZ(int x, int y, Slope corners);
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    27
uint GetSlopeZ(int x, int y);
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    28
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    29
static inline Point RemapCoords(int x, int y, int z)
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    30
{
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    31
	Point pt;
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    32
	pt.x = (y - x) * 2;
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    33
	pt.y = y + x - z;
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    34
	return pt;
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    35
}
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    36
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    37
static inline Point RemapCoords2(int x, int y)
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    38
{
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    39
	return RemapCoords(x, y, GetSlopeZ(x, y));
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    40
}
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    41
6743
cabfaa4a0295 (svn r10766) [NewGRF_ports] -Sync: with trunk r10651-10765
richk
parents: 6719
diff changeset
    42
uint ApplyFoundationToSlope(Foundation f, Slope *s);
cabfaa4a0295 (svn r10766) [NewGRF_ports] -Sync: with trunk r10651-10765
richk
parents: 6719
diff changeset
    43
void DrawFoundation(TileInfo *ti, Foundation f);
6719
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    44
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    45
void DoClearSquare(TileIndex tile);
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    46
void RunTileLoop();
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    47
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    48
uint32 GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode);
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    49
void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    50
void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player);
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    51
void AnimateTile(TileIndex tile);
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    52
void ClickTile(TileIndex tile);
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    53
void GetTileDesc(TileIndex tile, TileDesc *td);
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    54
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    55
void InitializeLandscape();
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    56
void GenerateLandscape(byte mode);
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    57
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    58
void ConvertGroundTilesIntoWaterTiles();
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    59
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    60
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng);
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    61
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6669
diff changeset
    62
#endif /* LANDSCAPE_H */