author | rubidium |
Mon, 07 Jan 2008 00:57:19 +0000 | |
changeset 8211 | 29a8510dfd62 |
parent 7640 | 8cf1b20cc69f |
child 8237 | 6f925c9cf836 |
permissions | -rw-r--r-- |
7583
4896ec945d21
(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$ */ |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
2 |
|
4896ec945d21
(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 */ |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
4 |
|
4896ec945d21
(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 |
4896ec945d21
(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 |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
7 |
|
4896ec945d21
(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" |
8211
29a8510dfd62
(svn r11774) -Change: do not include variables.h in a header when it is not needed.
rubidium
parents:
7640
diff
changeset
|
9 |
#include "settings_type.h" |
7583
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
10 |
|
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
11 |
/** |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
12 |
* Autoslope check for tiles with an entrance on an edge. |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
13 |
* E.g. depots and non-drive-through-road-stops. |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
14 |
* |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
15 |
* The test succeeds if the slope is not steep and at least one corner of the entrance edge is on the TileMaxZ() level. |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
16 |
* |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
17 |
* @note The test does not check if autoslope is enabled at all. |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
18 |
* |
4896ec945d21
(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 tile The tile. |
4896ec945d21
(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 z_new New TileZ. |
4896ec945d21
(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 tileh_new New TileSlope. |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
22 |
* @param entrance Entrance edge. |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
23 |
* @return true iff terraforming is allowed. |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
24 |
*/ |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
25 |
static inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, uint z_new, Slope tileh_new, DiagDirection entrance) |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
26 |
{ |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
27 |
if (IsSteepSlope(tileh_new) || (GetTileMaxZ(tile) != z_new + GetSlopeMaxZ(tileh_new))) return false; |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
28 |
return ((tileh_new == SLOPE_FLAT) || CanBuildDepotByTileh(entrance, tileh_new)); |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
29 |
} |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
30 |
|
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
31 |
/** |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
32 |
* Tests if autoslope is enabled for _current_player. |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
33 |
* |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
34 |
* Autoslope is disabled for town/industry construction and old ai players. |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
35 |
* |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
36 |
* @return true iff autoslope is enabled. |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
37 |
*/ |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
38 |
static inline bool AutoslopeEnabled() |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
39 |
{ |
7640
8cf1b20cc69f
(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:
7583
diff
changeset
|
40 |
return (_patches.autoslope && |
8cf1b20cc69f
(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:
7583
diff
changeset
|
41 |
((IsValidPlayer(_current_player) && !_is_old_ai_player) || |
8cf1b20cc69f
(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:
7583
diff
changeset
|
42 |
(_current_player == OWNER_NONE && _game_mode == GM_EDITOR))); |
7583
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
43 |
} |
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
44 |
|
4896ec945d21
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
45 |
#endif /* AUTOSLOPE_H */ |