(svn r10564) [NoAI] -Add: added a AITileList valuator that checks for a NxM buildable spot with the entry from the AITileList as top-left tile
/* $Id$ */
/** @file ai_station.cpp handles the functions of the AIStation class */
#include "ai_station.hpp"
#include "ai_cargo.hpp"
#include "../../station.h"
/* static */ bool AIStation::IsValidStation(StationID station_id)
{
return ::IsValidStationID(station_id) && ::GetStation(station_id)->owner == _current_player;
}
/* static */ TileIndex AIStation::GetLocation(StationID station_id)
{
if (!AIStation::IsValidStation(station_id)) return INVALID_TILE;
return ::GetStation(station_id)->xy;
}
/* static */ int32 AIStation::GetCargoWaiting(StationID station_id, CargoID cargo_id)
{
if (!AIStation::IsValidStation(station_id)) return -1;
if (!AICargo::IsValidCargo(cargo_id)) return -1;
return ::GetStation(station_id)->goods[cargo_id].cargo.Count();
}
/* static */ int32 AIStation::GetCargoRating(StationID station_id, CargoID cargo_id)
{
if (!AIStation::IsValidStation(station_id)) return -1;
if (!AICargo::IsValidCargo(cargo_id)) return -1;
return ::GetStation(station_id)->goods[cargo_id].rating * 101 >> 8;
}