Made some adjustments to the game's ranging

This commit is contained in:
2011-06-28 22:27:33 -04:00
parent 8550b0f8f1
commit d2322a7caf
4 changed files with 8 additions and 6 deletions

View File

@ -10,6 +10,8 @@ using std::list;
int GameData::PLAYER1_COLOUR = 0x4a483f;
int GameData::PLAYER2_COLOUR = 0x090c7a;
int GameData::BASE_MOVE_RADIUS = 75;
GameData::GameData()
: Graph(true)
{
@ -180,17 +182,17 @@ int GameData::get_range(Vertex* node)
if (node == NULL) node = current;
if (node == NULL) return 0;
else if (mode == MODE_MOVE) return 100;
else if (mode == MODE_MOVE) return BASE_MOVE_RADIUS;
else if (mode == MODE_ATTACK)
{
int range = 200;
int range = BASE_MOVE_RADIUS;
list<Vertex*> neighbors = node->neighbors;
for(list<Vertex*>::iterator cursor = neighbors.begin();
cursor != neighbors.end(); cursor++)
{
Vertex* v = *cursor;
range -= 100 - MathUtils::distance(v->x, v->y, node->x, node->y);
range -= (100 - MathUtils::distance(v->x, v->y, node->x, node->y)) / 2;
}
if (range < 0) range = 0;
return range;