Moved distance limiting code to a smarter location, refactored related code
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
using std::abs;
|
||||
|
||||
int Graph::MAX_MOVE_DISTANCE = 100;
|
||||
|
||||
Graph::Graph()
|
||||
{
|
||||
@ -75,10 +76,11 @@ void Graph::select_vertex(int x, int y)
|
||||
|
||||
void Graph::add_vertex(int x, int y, int size)
|
||||
{
|
||||
Vertex* v = new Vertex();
|
||||
v->x = x;
|
||||
v->y = y;
|
||||
if (current_vertex != NULL &&
|
||||
(Vertex::distance(*current_vertex, Vertex(x, y)) > MAX_MOVE_DISTANCE))
|
||||
return;
|
||||
|
||||
Vertex* v = new Vertex(x, y);
|
||||
v->x_min = x - size/2;
|
||||
v->x_max = x + size/2;
|
||||
v->y_min = y - size/2;
|
||||
|
Reference in New Issue
Block a user