summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-07-17 23:26:59 +0300
committerAndrei Karas <akaras@inbox.ru>2012-07-17 23:26:59 +0300
commit7e0a97d2521b9ce57003176e82a0b5564aa003c2 (patch)
tree5b2cfe1afe09bea1063f783050c1fb549daee76d /src/net/tmwa
parentf68cbf700a99f2f184715a5b8025bcb4b6525391 (diff)
downloadmanaplus-7e0a97d2521b9ce57003176e82a0b5564aa003c2.tar.gz
manaplus-7e0a97d2521b9ce57003176e82a0b5564aa003c2.tar.bz2
manaplus-7e0a97d2521b9ce57003176e82a0b5564aa003c2.tar.xz
manaplus-7e0a97d2521b9ce57003176e82a0b5564aa003c2.zip
Fix more code style and additional warnings.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/beinghandler.cpp6
-rw-r--r--src/net/tmwa/messagein.cpp2
-rw-r--r--src/net/tmwa/messageout.cpp4
-rw-r--r--src/net/tmwa/npchandler.cpp2
-rw-r--r--src/net/tmwa/partyhandler.cpp8
-rw-r--r--src/net/tmwa/tradehandler.cpp2
6 files changed, 14 insertions, 10 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 855972b95..dc815bf1c 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -518,7 +518,8 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType)
dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3
msg.readInt8(); // karma
// reserving bit for future usage
- dstBeing->setGender(Being::intToGender(msg.readInt8() & 3));
+ dstBeing->setGender(Being::intToGender(
+ static_cast<uint8_t>(msg.readInt8() & 3)));
// Set these after the gender, as the sprites may be gender-specific
dstBeing->setSprite(SPRITE_WEAPON, weapon, "", 1, true);
@@ -647,7 +648,8 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType)
dstBeing->setStunMode(stunMode);
dstBeing->setStatusEffectBlock(0, static_cast<uint16_t>(
(statusEffects >> 16) & 0xffff));
- dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff);
+ dstBeing->setStatusEffectBlock(16, static_cast<uint16_t>(
+ statusEffects & 0xffff));
if (msgType == 3 && dstBeing->getType() == Being::PLAYER)
dstBeing->setMoveTime();
diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp
index 698d7211c..2b65a2a3a 100644
--- a/src/net/tmwa/messagein.cpp
+++ b/src/net/tmwa/messagein.cpp
@@ -77,7 +77,7 @@ int MessageIn::readInt32()
}
mPos += 4;
PacketCounters::incInBytes(4);
- DEBUGLOG(strprintf("readInt32: %u", value));
+ DEBUGLOG(strprintf("readInt32: %u", static_cast<unsigned>(value)));
return value;
}
diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp
index 9e9e264eb..57cbceca3 100644
--- a/src/net/tmwa/messageout.cpp
+++ b/src/net/tmwa/messageout.cpp
@@ -91,7 +91,9 @@ static_cast<unsigned short>(w)) >> 8))
void MessageOut::writeCoordinates(unsigned short x, unsigned short y,
unsigned char direction)
{
- DEBUGLOG(strprintf("writeCoordinates: %u,%u %u", x, y, direction));
+ DEBUGLOG(strprintf("writeCoordinates: %u,%u %u",
+ static_cast<unsigned>(x), static_cast<unsigned>(y),
+ static_cast<unsigned>(direction)));
char *data = mData + mPos;
mNetwork->mOutSize += 3;
mPos += 3;
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index be58f0bc5..c086cc7e4 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -302,7 +302,7 @@ void NpcHandler::processNpcCommand(Net::MessageIn &msg, int npcId)
{
mDialog->setAvatarDirection(
Net::MessageIn::fromServerDirection(
- msg.readInt32())); // direction
+ static_cast<uint8_t>(msg.readInt32()))); // direction
}
break;
case 8: // set avatar action
diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp
index d1429a815..74826e5cd 100644
--- a/src/net/tmwa/partyhandler.cpp
+++ b/src/net/tmwa/partyhandler.cpp
@@ -193,8 +193,8 @@ void PartyHandler::setShareExperience(PartyShare share)
return;
MessageOut outMsg(CMSG_PARTY_SETTINGS);
- outMsg.writeInt16(share);
- outMsg.writeInt16(mShareItems);
+ outMsg.writeInt16(static_cast<int16_t>(share));
+ outMsg.writeInt16(static_cast<int16_t>(mShareItems));
}
void PartyHandler::setShareItems(PartyShare share)
@@ -203,8 +203,8 @@ void PartyHandler::setShareItems(PartyShare share)
return;
MessageOut outMsg(CMSG_PARTY_SETTINGS);
- outMsg.writeInt16(mShareExp);
- outMsg.writeInt16(share);
+ outMsg.writeInt16(static_cast<int16_t>(mShareExp));
+ outMsg.writeInt16(static_cast<int16_t>(share));
}
} // namespace TmwAthena
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index d4c1e1e08..f572e6cff 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -109,7 +109,7 @@ void TradeHandler::respond(bool accept)
PlayerInfo::setTrading(false);
MessageOut outMsg(CMSG_TRADE_RESPONSE);
- outMsg.writeInt8(accept ? 3 : 4);
+ outMsg.writeInt8(static_cast<int8_t>(accept ? 3 : 4));
}
void TradeHandler::addItem(Item *item, int amount)