diff options
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r-- | src/server/mainwindow/mainwindow.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 17bfdb2..ec69a4c 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -220,7 +220,7 @@ MainWindow::~MainWindow() } /** Squared euclidean distance (why is this not implemented in QPoint?) */ -int distance(QPoint a, QPoint b) +static int distance(QPoint a, QPoint b) { const int dx = a.x() - b.x(); const int dy = a.y() - b.y(); @@ -228,14 +228,6 @@ int distance(QPoint a, QPoint b) return sum; } -int distance(QPointF a, QPointF b) -{ - const qreal dx = a.x() - b.x(); - const qreal dy = a.y() - b.y(); - const qreal sum = dx * dx + dy * dy; - return int(sum); -} - /** * \brief: find the closest available frame. * @@ -249,16 +241,9 @@ int distance(QPointF a, QPointF b) * @param toIgnore, ignore this connectionframe when considering free slots * @return the free slot */ -QPoint MainWindow::closestFreeSlot(QPoint preferredPixels, ConnectionFrame* toIgnore) +QPoint MainWindow::closestFreeSlot(const QPoint preferredPixels, const ConnectionFrame* toIgnore) { const bool pickFirstOne = ( preferredPixels == QPoint(-1, -1) ); - if (!pickFirstOne && toIgnore != nullptr) { - // Check if we're already in the desired location and skip all the checks - QPoint desired = QPoint(preferredPixels.x() / getTileWidthPx(), preferredPixels.y() / getTileHeightPx()); - if (desired == toIgnore->getGridPosition()) { - return desired; - } - } const QSize& clientSize = serverApp->getCurrentRoom()->clientSize; #define GRID(X,Y) (grid[((X) * _tilesY) + (Y)]) bool *grid = new bool[_tilesX * _tilesY]; |