author | skidd13 |
Tue, 20 Nov 2007 14:11:19 +0000 | |
changeset 8428 | f8300c908bd9 |
parent 8136 | d1a4486be2fd |
child 8707 | 55835d8fbfcd |
permissions | -rw-r--r-- |
8079
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
2 |
|
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
3 |
/** @file autoslope.h */ |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
4 |
|
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
5 |
#ifndef AUTOSLOPE_H |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
6 |
#define AUTOSLOPE_H |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
7 |
|
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
8 |
#include "depot.h" |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
9 |
|
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
10 |
/** |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
11 |
* Autoslope check for tiles with an entrance on an edge. |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
12 |
* E.g. depots and non-drive-through-road-stops. |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
13 |
* |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
14 |
* The test succeeds if the slope is not steep and at least one corner of the entrance edge is on the TileMaxZ() level. |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
15 |
* |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
16 |
* @note The test does not check if autoslope is enabled at all. |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
17 |
* |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
18 |
* @param tile The tile. |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
19 |
* @param z_new New TileZ. |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
20 |
* @param tileh_new New TileSlope. |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
21 |
* @param entrance Entrance edge. |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
22 |
* @return true iff terraforming is allowed. |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
23 |
*/ |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
24 |
static inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, uint z_new, Slope tileh_new, DiagDirection entrance) |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
25 |
{ |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
26 |
if (IsSteepSlope(tileh_new) || (GetTileMaxZ(tile) != z_new + GetSlopeMaxZ(tileh_new))) return false; |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
27 |
return ((tileh_new == SLOPE_FLAT) || CanBuildDepotByTileh(entrance, tileh_new)); |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
28 |
} |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
29 |
|
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
30 |
/** |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
31 |
* Tests if autoslope is enabled for _current_player. |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
32 |
* |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
33 |
* Autoslope is disabled for town/industry construction and old ai players. |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
34 |
* |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
35 |
* @return true iff autoslope is enabled. |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
36 |
*/ |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
37 |
static inline bool AutoslopeEnabled() |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
38 |
{ |
8136
d1a4486be2fd
(svn r11171) -Fix [FS#1257]: disable autoslope for automatically changed stuff (like towns and industries) and enable it in the scenario editor. Patch by frosch.
rubidium
parents:
8079
diff
changeset
|
39 |
return (_patches.autoslope && |
d1a4486be2fd
(svn r11171) -Fix [FS#1257]: disable autoslope for automatically changed stuff (like towns and industries) and enable it in the scenario editor. Patch by frosch.
rubidium
parents:
8079
diff
changeset
|
40 |
((IsValidPlayer(_current_player) && !_is_old_ai_player) || |
d1a4486be2fd
(svn r11171) -Fix [FS#1257]: disable autoslope for automatically changed stuff (like towns and industries) and enable it in the scenario editor. Patch by frosch.
rubidium
parents:
8079
diff
changeset
|
41 |
(_current_player == OWNER_NONE && _game_mode == GM_EDITOR))); |
8079
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
42 |
} |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
43 |
|
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
44 |
#endif /* AUTOSLOPE_H */ |