Fixed bug with distance calculations... distance <> slope
This commit is contained in:
13
gamecore.cpp
13
gamecore.cpp
@ -1,9 +1,6 @@
|
||||
#include "gamecore.h"
|
||||
#include "drawutils.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <iostream>
|
||||
#endif
|
||||
#include "debug.h"
|
||||
|
||||
int GameCore::NODE_SIZE = 25;
|
||||
int GameCore::MAX_MOVE_DISTANCE = 200;
|
||||
@ -132,6 +129,14 @@ void GameCore::on_lbutton_down(int x, int y)
|
||||
new_v.x = x;
|
||||
new_v.y = y;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (v != NULL)
|
||||
cerr << "debug: GameCore::on_lbutton_down(): distance="
|
||||
<< Vertex::distance(*v, new_v) << "\n";
|
||||
else
|
||||
cerr << "debug: GameCore::on_lbutton_down(): distance=0, current_vertex is NULL\n";
|
||||
#endif
|
||||
|
||||
if (v != NULL && (Vertex::distance(*v, new_v) > MAX_MOVE_DISTANCE))
|
||||
return;
|
||||
|
||||
|
Reference in New Issue
Block a user