src/ai/api/ai_tile.hpp
author truelight
Sat, 14 Jul 2007 22:06:38 +0000
branchnoai
changeset 9658 e7675771bca4
parent 9619 6e81cec30a2b
child 9698 1d50fe99b7e9
permissions -rw-r--r--
(svn r10565) [NoAI] -Add: allow giving width, height and radius to check for cargo acceptance
/* $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.
	 * @param cargo_type the cargo to check the acceptance of.
	 * @param width the width of the station.
	 * @param height the height of the station.
	 * @param radius the radius of the station.
	 * @return value below 8 means no acceptance; the more the better.
	 */
	static int32 GetCargoAcceptance(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius);
};

#endif /* AI_TILE_HPP */