mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
NoAI is an API (a framework) to build your own AIs in. See: http://wiki.openttd.org/wiki/index.php/AI:Main_Page With many thanks to: - glx and Rubidium for their syncing, feedback and hard work - Yexo for his feedback, patches, and AIs which tested the system very deep - Morloth for his feedback and patches - TJIP for hosting a challenge which kept NoAI on track - All AI authors for testing our AI API, and all other people who helped in one way or another -Remove: all old AIs and their cheats/hacks
47 lines
1.3 KiB
C
47 lines
1.3 KiB
C
/* $Id$ */
|
|
|
|
/** @file autoslope.h Functions related to autoslope. */
|
|
|
|
#ifndef AUTOSLOPE_H
|
|
#define AUTOSLOPE_H
|
|
|
|
#include "settings_type.h"
|
|
#include "company_func.h"
|
|
#include "depot_func.h"
|
|
|
|
/**
|
|
* Autoslope check for tiles with an entrance on an edge.
|
|
* E.g. depots and non-drive-through-road-stops.
|
|
*
|
|
* The test succeeds if the slope is not steep and at least one corner of the entrance edge is on the TileMaxZ() level.
|
|
*
|
|
* @note The test does not check if autoslope is enabled at all.
|
|
*
|
|
* @param tile The tile.
|
|
* @param z_new New TileZ.
|
|
* @param tileh_new New TileSlope.
|
|
* @param entrance Entrance edge.
|
|
* @return true iff terraforming is allowed.
|
|
*/
|
|
static inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, uint z_new, Slope tileh_new, DiagDirection entrance)
|
|
{
|
|
if (IsSteepSlope(tileh_new) || (GetTileMaxZ(tile) != z_new + GetSlopeMaxZ(tileh_new))) return false;
|
|
return ((tileh_new == SLOPE_FLAT) || CanBuildDepotByTileh(entrance, tileh_new));
|
|
}
|
|
|
|
/**
|
|
* Tests if autoslope is enabled for _current_company.
|
|
*
|
|
* Autoslope is disabled for town/industry construction.
|
|
*
|
|
* @return true iff autoslope is enabled.
|
|
*/
|
|
static inline bool AutoslopeEnabled()
|
|
{
|
|
return (_settings_game.construction.autoslope &&
|
|
(_current_company < MAX_COMPANIES ||
|
|
(_current_company == OWNER_NONE && _game_mode == GM_EDITOR)));
|
|
}
|
|
|
|
#endif /* AUTOSLOPE_H */
|