author | belugas |
Sun, 15 Jun 2008 02:48:25 +0000 | |
changeset 10965 | a2b5f6f9be0c |
parent 10775 | 7061477bfbcf |
child 11161 | 7d0fac8f14cd |
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 |
|
10429
1b99254f9607
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
10222
diff
changeset
|
3 |
/** @file autoslope.h Functions related to autoslope. */ |
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
|
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 |
|
8707
55835d8fbfcd
(svn r11774) -Change: do not include variables.h in a header when it is not needed.
rubidium
parents:
8136
diff
changeset
|
8 |
#include "settings_type.h" |
8750
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8733
diff
changeset
|
9 |
#include "player_func.h" |
10222
b6919c94cc77
(svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
rubidium
parents:
8750
diff
changeset
|
10 |
#include "depot_func.h" |
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
|
11 |
|
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 |
/** |
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 |
* 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
|
14 |
* 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
|
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 |
* 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
|
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 |
* @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
|
19 |
* |
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 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
|
21 |
* @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
|
22 |
* @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
|
23 |
* @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
|
24 |
* @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
|
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 |
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
|
27 |
{ |
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 |
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
|
29 |
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
|
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 |
|
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 |
* 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
|
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 |
* 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
|
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 |
* @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
|
38 |
*/ |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
39 |
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
|
40 |
{ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10703
diff
changeset
|
41 |
return (_settings_game.construction.autoslope && |
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
|
42 |
((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
|
43 |
(_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
|
44 |
} |
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
45 |
|
037a8b09887c
(svn r11108) -Fix (r11107): somebody forgot to add some file ;) Spoils the fun of the previous cryptic message though.
rubidium
parents:
diff
changeset
|
46 |
#endif /* AUTOSLOPE_H */ |