author | rubidium |
Thu, 17 Jul 2008 20:13:01 +0000 | |
changeset 9652 | 0405e98d8e96 |
parent 9413 | 7042a8ec3fa8 |
child 9659 | 187142ff9b6c |
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 |
|
9111
48ce04029fe4
(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:
8962
diff
changeset
|
3 |
/** @file autoslope.h Functions related to autoslope. */ |
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
|
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 |
|
8211
29a8510dfd62
(svn r11774) -Change: do not include variables.h in a header when it is not needed.
rubidium
parents:
7640
diff
changeset
|
8 |
#include "settings_type.h" |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8237
diff
changeset
|
9 |
#include "player_func.h" |
8962
1b263c69799d
(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:
8254
diff
changeset
|
10 |
#include "depot_func.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
|
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 |
/** |
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 |
* 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
|
14 |
* 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
|
15 |
* |
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 |
* 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
|
17 |
* |
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 |
* @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
|
19 |
* |
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 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
|
21 |
* @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
|
22 |
* @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
|
23 |
* @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
|
24 |
* @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
|
25 |
*/ |
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 |
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
|
27 |
{ |
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 |
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
|
29 |
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
|
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 |
/** |
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 |
* 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
|
34 |
* |
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 |
* 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
|
36 |
* |
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 |
* @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
|
38 |
*/ |
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 |
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
|
40 |
{ |
9413
7042a8ec3fa8
(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:
9354
diff
changeset
|
41 |
return (_settings_game.construction.autoslope && |
9652
0405e98d8e96
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
9413
diff
changeset
|
42 |
((IsValidPlayerID(_current_player) && !_is_old_ai_player) || |
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
|
43 |
(_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
|
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 |
|
4896ec945d21
(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 */ |