From d2322a7caf280f97e78efd82982c4313f87525d4 Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Tue, 28 Jun 2011 22:27:33 -0400 Subject: [PATCH] Made some adjustments to the game's ranging --- game.cpp | 2 +- game.h | 2 -- gamedata.cpp | 8 +++++--- gamedata.h | 2 ++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/game.cpp b/game.cpp index db9ab83..11a3ebe 100644 --- a/game.cpp +++ b/game.cpp @@ -4,7 +4,7 @@ #include "debug.h" #include -int Game::NODE_RADIUS = 12; +int Game::NODE_RADIUS = 10; Game::Game(SDL_Surface* display) diff --git a/game.h b/game.h index ff5ba93..12bcb5c 100644 --- a/game.h +++ b/game.h @@ -38,8 +38,6 @@ class Game : public GameState GameData data; static int NODE_RADIUS; - static int MAX_MOVE_DISTANCE; - // surfaces containing textures to draw SDL_Surface* background; diff --git a/gamedata.cpp b/gamedata.cpp index 6997690..2038cf0 100644 --- a/gamedata.cpp +++ b/gamedata.cpp @@ -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 neighbors = node->neighbors; for(list::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; diff --git a/gamedata.h b/gamedata.h index b117e2b..1b7bb81 100644 --- a/gamedata.h +++ b/gamedata.h @@ -52,6 +52,8 @@ class GameData : public Graph static int PLAYER1_COLOUR; static int PLAYER2_COLOUR; + + static int BASE_MOVE_RADIUS; }; #endif