From 0056412ed33b941d72a175dcd3f025abcd8fc02b Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Fri, 15 Apr 2011 23:55:14 +0200 Subject: Post-review fixes. - Removed unnecessary comments - Removed a useless contains() check in getTileCenter() - Fix the above function documentation - Don't permit FloorItem to be created without a map object. Reviewed-by: Thorbjorn Lindeijer. --- src/flooritem.cpp | 8 +++----- src/map.cpp | 3 --- src/map.h | 2 +- src/net/manaserv/playerhandler.cpp | 3 --- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/flooritem.cpp b/src/flooritem.cpp index 07903a79..c92619ff 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -38,11 +38,9 @@ FloorItem::FloorItem(int id, mPos = position; setMap(map); - if (map) - { - mX = (int)position.x / map->getTileWidth(); - mY = (int)position.y / map->getTileHeight(); - } + + mX = (int)position.x / map->getTileWidth(); + mY = (int)position.y / map->getTileHeight(); setupSpriteDisplay(itemDb->get(itemId).getDisplay()); } diff --git a/src/map.cpp b/src/map.cpp index 949b00bd..b660653d 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -611,9 +611,6 @@ Vector Map::getTileCenter(int x, int y) { Vector tileCenterPos; - if (!contains(x, y)) - return tileCenterPos; - tileCenterPos.x = x * mTileWidth + mTileWidth / 2; tileCenterPos.y = y * mTileHeight + mTileHeight / 2; return tileCenterPos; diff --git a/src/map.h b/src/map.h index a2bd791a..d49cd920 100644 --- a/src/map.h +++ b/src/map.h @@ -268,7 +268,7 @@ class Map : public Properties { return mTileHeight; } /** - * Returns the nearest tile center position in pixels coordinates. + * Returns the tile center position in pixel coordinates. * * @param x the horizontal tile position * @param y the vertical tile position diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp index 317481ab..0ac55d86 100644 --- a/src/net/manaserv/playerhandler.cpp +++ b/src/net/manaserv/playerhandler.cpp @@ -420,10 +420,7 @@ Vector PlayerHandler::getDefaultMoveSpeed() const Vector PlayerHandler::getPixelsPerTickMoveSpeed(const Vector &speed, Map *map) { - // We don't use z for now. Vector speedInTicks; - // speedInTicks.x = speedInTicks.y = speedInTicks.z = 0; - // ^ Done by constructor Game *game = Game::instance(); if (game && !map) -- cgit v1.2.3-70-g09d2