src/ai/api/ai_tilelist_valuator.cpp
branchnoai
changeset 9609 f0dbf5850145
parent 9604 89b96457aae4
child 9611 5cf58c6571b7
equal deleted inserted replaced
9608:6082e2e7e7f5 9609:f0dbf5850145
     1 #include "ai_tilelist_valuator.hpp"
     1 #include "ai_tilelist_valuator.hpp"
     2 #include "../../tile.h"
     2 #include "../../tile.h"
     3 #include "../../road_map.h"
     3 #include "../../road_map.h"
       
     4 #include "../../variables.h"
       
     5 #include "../../station.h"
     4 
     6 
     5 int32 AITileListBuildable::Valuate(int32 tile) const
     7 int32 AITileListBuildable::Valuate(int32 tile) const
     6 {
     8 {
     7 	switch (::GetTileType(tile)) {
     9 	switch (::GetTileType(tile)) {
     8 		default: return 1;
    10 		default: return 1;
    32 
    34 
    33 int32 AITileListRoadTile::Valuate(int32 tile) const
    35 int32 AITileListRoadTile::Valuate(int32 tile) const
    34 {
    36 {
    35 	return ::IsTileType(tile, MP_STREET) && ::GetRoadTileType(tile) != ROAD_TILE_DEPOT;
    37 	return ::IsTileType(tile, MP_STREET) && ::GetRoadTileType(tile) != ROAD_TILE_DEPOT;
    36 }
    38 }
       
    39 
       
    40 int32 AITileListCargoAcceptance::Valuate(int32 tile) const
       
    41 {
       
    42 	/* TODO -- Make it an enum via constructor, for now it assumes RoadVehicle Station */
       
    43 	uint rad = 3;
       
    44 
       
    45 	AcceptedCargo accepts;
       
    46 	GetAcceptanceAroundTiles(accepts, tile, 1, 1, _patches.modified_catchment ? rad : 4);
       
    47 	return accepts[this->cargo_type];
       
    48 }