author | truelight |
Sat, 14 Jul 2007 08:54:17 +0000 | |
branch | noai |
changeset 9655 | e8e43f333832 |
parent 9617 | df9cedf12aab |
child 9657 | f2c6e332d8bc |
permissions | -rw-r--r-- |
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
1 |
#include "ai_tilelist_valuator.hpp" |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9611
diff
changeset
|
2 |
#include "ai_tile.hpp" |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9611
diff
changeset
|
3 |
#include "ai_road.hpp" |
9655
e8e43f333832
(svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents:
9617
diff
changeset
|
4 |
#include "ai_map.hpp" |
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
5 |
#include "../../tile.h" |
9603
49323bf80ebd
(svn r9747) [NoAI] -Add: added AITileListRoadTile and AITileListNeighbourRoad as Valuators for AITileList
truelight
parents:
9592
diff
changeset
|
6 |
#include "../../road_map.h" |
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
7 |
|
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
8 |
int32 AITileListBuildable::Valuate(int32 tile) const |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
9 |
{ |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9611
diff
changeset
|
10 |
return AITile::IsBuildable(tile); |
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
11 |
} |
9603
49323bf80ebd
(svn r9747) [NoAI] -Add: added AITileListRoadTile and AITileListNeighbourRoad as Valuators for AITileList
truelight
parents:
9592
diff
changeset
|
12 |
|
9611
5cf58c6571b7
(svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents:
9609
diff
changeset
|
13 |
int32 AITileListSlope::Valuate(int32 tile) const |
5cf58c6571b7
(svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents:
9609
diff
changeset
|
14 |
{ |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9611
diff
changeset
|
15 |
return AITile::GetSlope(tile); |
9611
5cf58c6571b7
(svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents:
9609
diff
changeset
|
16 |
} |
5cf58c6571b7
(svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents:
9609
diff
changeset
|
17 |
|
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9611
diff
changeset
|
18 |
int32 AITileListNeighbourRoadCount::Valuate(int32 tile) const |
9603
49323bf80ebd
(svn r9747) [NoAI] -Add: added AITileListRoadTile and AITileListNeighbourRoad as Valuators for AITileList
truelight
parents:
9592
diff
changeset
|
19 |
{ |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9611
diff
changeset
|
20 |
return AIRoad::GetNeighbourRoadCount(tile); |
9603
49323bf80ebd
(svn r9747) [NoAI] -Add: added AITileListRoadTile and AITileListNeighbourRoad as Valuators for AITileList
truelight
parents:
9592
diff
changeset
|
21 |
} |
49323bf80ebd
(svn r9747) [NoAI] -Add: added AITileListRoadTile and AITileListNeighbourRoad as Valuators for AITileList
truelight
parents:
9592
diff
changeset
|
22 |
|
49323bf80ebd
(svn r9747) [NoAI] -Add: added AITileListRoadTile and AITileListNeighbourRoad as Valuators for AITileList
truelight
parents:
9592
diff
changeset
|
23 |
int32 AITileListRoadTile::Valuate(int32 tile) const |
49323bf80ebd
(svn r9747) [NoAI] -Add: added AITileListRoadTile and AITileListNeighbourRoad as Valuators for AITileList
truelight
parents:
9592
diff
changeset
|
24 |
{ |
49323bf80ebd
(svn r9747) [NoAI] -Add: added AITileListRoadTile and AITileListNeighbourRoad as Valuators for AITileList
truelight
parents:
9592
diff
changeset
|
25 |
return ::IsTileType(tile, MP_STREET) && ::GetRoadTileType(tile) != ROAD_TILE_DEPOT; |
49323bf80ebd
(svn r9747) [NoAI] -Add: added AITileListRoadTile and AITileListNeighbourRoad as Valuators for AITileList
truelight
parents:
9592
diff
changeset
|
26 |
} |
9609
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9604
diff
changeset
|
27 |
|
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9604
diff
changeset
|
28 |
int32 AITileListCargoAcceptance::Valuate(int32 tile) const |
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9604
diff
changeset
|
29 |
{ |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9611
diff
changeset
|
30 |
return AITile::GetCargoAcceptance(tile, this->cargo_type); |
9609
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9604
diff
changeset
|
31 |
} |
9655
e8e43f333832
(svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents:
9617
diff
changeset
|
32 |
|
e8e43f333832
(svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents:
9617
diff
changeset
|
33 |
int32 AITileListDistanceManhattanToTile::Valuate(int32 tile) const |
e8e43f333832
(svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents:
9617
diff
changeset
|
34 |
{ |
e8e43f333832
(svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents:
9617
diff
changeset
|
35 |
return AIMap::DistanceManhattan(this->tile, tile); |
e8e43f333832
(svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents:
9617
diff
changeset
|
36 |
} |
e8e43f333832
(svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents:
9617
diff
changeset
|
37 |
|
e8e43f333832
(svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents:
9617
diff
changeset
|
38 |
int32 AITileListDistanceSquareToTile::Valuate(int32 tile) const |
e8e43f333832
(svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents:
9617
diff
changeset
|
39 |
{ |
e8e43f333832
(svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents:
9617
diff
changeset
|
40 |
return AIMap::DistanceSquare(this->tile, tile); |
e8e43f333832
(svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents:
9617
diff
changeset
|
41 |
} |