summaryrefslogtreecommitdiff
path: root/src/net/manaserv
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-06-17 16:46:06 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-06-17 16:46:06 +0200
commit914d3de7c324cb1ec456892702689718352a7842 (patch)
treeeb05c251adb6f012a40f3d7de4eb42ab854b7d94 /src/net/manaserv
parentfaf0a45d6b8b85acd2836cf5e8e7f7c5b161931d (diff)
downloadmana-client-914d3de7c324cb1ec456892702689718352a7842.tar.gz
mana-client-914d3de7c324cb1ec456892702689718352a7842.tar.bz2
mana-client-914d3de7c324cb1ec456892702689718352a7842.tar.xz
mana-client-914d3de7c324cb1ec456892702689718352a7842.zip
First pass on removing tile hard coded values.
Every files has been checked against the hard coded 32 values except the map.cpp file. I also added convenience functions in the Game class, centralized the default item icon size, and removed two unused defines in being.cpp.
Diffstat (limited to 'src/net/manaserv')
-rw-r--r--src/net/manaserv/playerhandler.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index 4249bac8..ec71143f 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -46,12 +46,11 @@
#include "net/manaserv/attributes.h"
/**
- * Max. distance we are willing to scroll after a teleport;
+ * Max. distance in tiles we are willing to scroll after a teleport;
* everything beyond will reset the port hard.
- * 32 is the nominal tile width/height.
* @todo: Make this parameter read from config.
*/
-static const int MAP_TELEPORT_SCROLL_DISTANCE = 8 * 32;
+static const int MAP_TELEPORT_SCROLL_DISTANCE = 8;
extern Net::PlayerHandler *playerHandler;
@@ -298,8 +297,10 @@ void PlayerHandler::handleMapChangeMessage(Net::MessageIn &msg)
/* Scroll if neccessary */
if (!sameMap
- || (abs(x - (int) playerPos.x) > MAP_TELEPORT_SCROLL_DISTANCE)
- || (abs(y - (int) playerPos.y) > MAP_TELEPORT_SCROLL_DISTANCE))
+ || (abs(x - (int) playerPos.x) > MAP_TELEPORT_SCROLL_DISTANCE
+ * game->getCurrentTileWidth())
+ || (abs(y - (int) playerPos.y) > MAP_TELEPORT_SCROLL_DISTANCE
+ * game->getCurrentTileHeight()))
{
scrollOffsetX = x - (int) playerPos.x;
scrollOffsetY = y - (int) playerPos.y;