author | truebrain |
Mon, 30 Jun 2008 13:36:06 +0000 | |
branch | noai |
changeset 11100 | b960288098b9 |
parent 10776 | 07203fc29812 |
permissions | -rw-r--r-- |
9703 | 1 |
/* $Id$ */ |
2 |
||
10455
22c441f5adf9
(svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents:
10249
diff
changeset
|
3 |
/** @file autoslope.h Functions related to autoslope. */ |
9703 | 4 |
|
5 |
#ifndef AUTOSLOPE_H |
|
6 |
#define AUTOSLOPE_H |
|
7 |
||
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9705
diff
changeset
|
8 |
#include "settings_type.h" |
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
9 |
#include "player_func.h" |
10249
58810805030e
(svn r12781) [NoAI] -Sync: with trunk r12711:12780.
rubidium
parents:
9724
diff
changeset
|
10 |
#include "depot_func.h" |
9703 | 11 |
|
12 |
/** |
|
13 |
* Autoslope check for tiles with an entrance on an edge. |
|
14 |
* E.g. depots and non-drive-through-road-stops. |
|
15 |
* |
|
16 |
* The test succeeds if the slope is not steep and at least one corner of the entrance edge is on the TileMaxZ() level. |
|
17 |
* |
|
18 |
* @note The test does not check if autoslope is enabled at all. |
|
19 |
* |
|
20 |
* @param tile The tile. |
|
21 |
* @param z_new New TileZ. |
|
22 |
* @param tileh_new New TileSlope. |
|
23 |
* @param entrance Entrance edge. |
|
24 |
* @return true iff terraforming is allowed. |
|
25 |
*/ |
|
26 |
static inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, uint z_new, Slope tileh_new, DiagDirection entrance) |
|
27 |
{ |
|
28 |
if (IsSteepSlope(tileh_new) || (GetTileMaxZ(tile) != z_new + GetSlopeMaxZ(tileh_new))) return false; |
|
29 |
return ((tileh_new == SLOPE_FLAT) || CanBuildDepotByTileh(entrance, tileh_new)); |
|
30 |
} |
|
31 |
||
32 |
/** |
|
33 |
* Tests if autoslope is enabled for _current_player. |
|
34 |
* |
|
35 |
* Autoslope is disabled for town/industry construction. |
|
36 |
* |
|
37 |
* @return true iff autoslope is enabled. |
|
38 |
*/ |
|
39 |
static inline bool AutoslopeEnabled() |
|
40 |
{ |
|
10776 | 41 |
return (_settings_game.construction.autoslope && |
9704 | 42 |
(IsValidPlayer(_current_player) || |
9705
e460e1c9d49a
(svn r11222) [NoAI] -Fix (r11221): my text editor decided to play with me between compilation and commit
glx
parents:
9704
diff
changeset
|
43 |
(_current_player == OWNER_NONE && _game_mode == GM_EDITOR))); |
9703 | 44 |
} |
45 |
||
46 |
#endif /* AUTOSLOPE_H */ |