From f4792bc06f21335fc2d1171d937ea7645ca0c253 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Mar 2011 22:13:37 +0200 Subject: Fix most conversions except manaserv net code and some other code. --- src/net/tmwa/playerhandler.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/net/tmwa/playerhandler.cpp') diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 55908093f..6078dd761 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -137,7 +137,8 @@ static const char *randomDeathMessage() N_("You're pining for the fjords.") }; - const int random = rand() % (sizeof(deadMsg) / sizeof(deadMsg[0])); + const int random = static_cast(rand() % (sizeof(deadMsg) + / sizeof(deadMsg[0]))); return gettext(deadMsg[random]); } @@ -228,10 +229,12 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) Map *map = game->getCurrentMap(); if (map) { - scrollOffsetX = (x - player_node->getTileX()) - * map->getTileWidth(); - scrollOffsetY = (y - player_node->getTileY()) - * map->getTileHeight(); + scrollOffsetX = static_cast((x + - player_node->getTileX()) + * map->getTileWidth()); + scrollOffsetY = static_cast((y + - player_node->getTileY()) + * map->getTileHeight()); } } @@ -260,7 +263,8 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) switch (type) { case 0x0000: - player_node->setWalkSpeed(Vector(value, value, 0)); + player_node->setWalkSpeed(Vector(static_cast( + value), static_cast(value), 0)); PlayerInfo::setStatBase(WALK_SPEED, value); PlayerInfo::setStatMod(WALK_SPEED, 0); break; @@ -644,7 +648,7 @@ void PlayerHandler::stopAttack() MessageOut outMsg(CMSG_PLAYER_STOP_ATTACK); } -void PlayerHandler::emote(int emoteId) +void PlayerHandler::emote(Uint8 emoteId) { MessageOut outMsg(CMSG_PLAYER_EMOTE); outMsg.writeInt8(emoteId); @@ -655,7 +659,7 @@ void PlayerHandler::increaseAttribute(int attr) if (attr >= STR && attr <= LUK) { MessageOut outMsg(CMSG_STAT_UPDATE_REQUEST); - outMsg.writeInt16(attr); + outMsg.writeInt16(static_cast(attr)); outMsg.writeInt8(1); } } @@ -665,7 +669,7 @@ void PlayerHandler::decreaseAttribute(int attr _UNUSED_) // Supported by eA? } -void PlayerHandler::increaseSkill(int skillId) +void PlayerHandler::increaseSkill(unsigned short skillId) { if (PlayerInfo::getAttribute(SKILL_POINTS) <= 0) return; @@ -693,7 +697,9 @@ void PlayerHandler::setDirection(char direction) void PlayerHandler::setDestination(int x, int y, int direction) { MessageOut outMsg(CMSG_PLAYER_CHANGE_DEST); - outMsg.writeCoordinates(x, y, direction); + outMsg.writeCoordinates(static_cast(x), + static_cast(y), + static_cast(direction)); } void PlayerHandler::changeAction(Being::Action action) -- cgit v1.2.3-60-g2f50