src/ai/api/ai_townlist_valuator.cpp
author truelight
Fri, 19 Oct 2007 14:03:27 +0000
branchnoai
changeset 9714 fdbdae7ea647
parent 9660 d0a430e8310b
child 9753 7209db94ad12
permissions -rw-r--r--
(svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
diff changeset
     1
#include "ai_townlist_valuator.hpp"
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
diff changeset
     2
#include "ai_town.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: 9616
diff changeset
     3
#include "ai_map.hpp"
9660
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9655
diff changeset
     4
#include "ai_base.hpp"
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9655
diff changeset
     5
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9655
diff changeset
     6
int32 AITownListRandomize::Valuate(int32 town) const
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9655
diff changeset
     7
{
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9655
diff changeset
     8
	return AIBase::Rand();
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9655
diff changeset
     9
}
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
diff changeset
    10
9616
ca607e3077dd (svn r9783) [NoAI] -Fix: make naming more consistent between Valuators: don't add Get before them.
truelight
parents: 9589
diff changeset
    11
int32 AITownListPopulation::Valuate(int32 town) const
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
diff changeset
    12
{
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
diff changeset
    13
	return AITown::GetPopulation(town);
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
diff changeset
    14
}
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
diff changeset
    15
9616
ca607e3077dd (svn r9783) [NoAI] -Fix: make naming more consistent between Valuators: don't add Get before them.
truelight
parents: 9589
diff changeset
    16
int32 AITownListLocation::Valuate(int32 town) const
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
diff changeset
    17
{
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
diff changeset
    18
	return AITown::GetLocation(town);
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
diff changeset
    19
}
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: 9616
diff changeset
    20
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: 9616
diff changeset
    21
int32 AITownListDistanceManhattanToTile::Valuate(int32 town) 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: 9616
diff changeset
    22
{
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: 9616
diff changeset
    23
	return AIMap::DistanceManhattan(this->tile, AITown::GetLocation(town));
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: 9616
diff changeset
    24
}
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: 9616
diff changeset
    25
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: 9616
diff changeset
    26
int32 AITownListDistanceSquareToTile::Valuate(int32 town) 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: 9616
diff changeset
    27
{
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: 9616
diff changeset
    28
	return AIMap::DistanceSquare(this->tile, AITown::GetLocation(town));
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: 9616
diff changeset
    29
}