src/ai/api/ai_tile.hpp
author truelight
Fri, 04 May 2007 22:59:59 +0000
branchnoai
changeset 9617 df9cedf12aab
child 9619 6e81cec30a2b
permissions -rw-r--r--
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
[NoAI] -Fix: move AITileListValuators self-defined checks to AITile so we can call it per tile (instead of only via AITileList)
/* $Id$ */

/** @file ai_tile.hpp tile related functions */

#ifndef AI_TILE_HPP
#define AI_TILE_HPP

#include "ai_abstractlist.hpp"

/**
 * Class that handles all tile related functions.
 */
class AITile : public AIObject {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AITile"; }

	/**
	 * Check if this tile is buildable (e.g.: no things on it that needs removing).
	 * @note Road and rail are considered buildable.
	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
	 * @param tile the tile to check on.
	 * @return true if it is buildable, false if not.
	 */
	static bool IsBuildable(TileIndex tile);

	/**
	 * Get the slope of a tile.
	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
	 * @param tile the tile to check on.
	 * @return 0 means flat, others indicate internal state of slope.
	 */
	static int32 GetSlope(TileIndex tile);

	/**
	 * Check how much cargo this tile accepts.
	 *  It creates a radius around the tile and adds up all acceptance of this
	 *   cargo and returns that value.
	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
	 * @param tile the tile to check on.
	 * @return value below 8 means no acceptance; the more the better.
	 */
	static int32 GetCargoAcceptance(TileIndex tile, CargoID cargo_type);
};

#endif /* AI_TILE_HPP */