summaryrefslogtreecommitdiff
path: root/src/net/eathena/charserverhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-02 14:05:30 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-02 14:05:30 +0300
commit962f182fcc989ec587282e44f889188ce241ba31 (patch)
treeda100971ec4952d0c56cb404862099c670bcfe0e /src/net/eathena/charserverhandler.cpp
parent4df121e6dcdf53436f50ce81dd60096ce0138a2c (diff)
downloadmv-962f182fcc989ec587282e44f889188ce241ba31.tar.gz
mv-962f182fcc989ec587282e44f889188ce241ba31.tar.bz2
mv-962f182fcc989ec587282e44f889188ce241ba31.tar.xz
mv-962f182fcc989ec587282e44f889188ce241ba31.zip
Add const to more classes.
Diffstat (limited to 'src/net/eathena/charserverhandler.cpp')
-rw-r--r--src/net/eathena/charserverhandler.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index 512300704..2d98eaa6a 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -105,7 +105,8 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg)
{
// msg.skip(4); // CharID, must be the same as player_node->charID
PlayerInfo::setCharId(msg.readInt32());
- GameHandler *gh = static_cast<GameHandler*>(Net::getGameHandler());
+ GameHandler *const gh = static_cast<GameHandler*>(
+ Net::getGameHandler());
gh->setMap(msg.readString(16));
if (config.getBoolValue("usePersistentIP"))
{
@@ -136,12 +137,13 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg)
case SMSG_CHANGE_MAP_SERVER:
{
- GameHandler *gh = static_cast<GameHandler*>(Net::getGameHandler());
+ GameHandler *const gh = static_cast<GameHandler*>(
+ Net::getGameHandler());
if (!gh || !mNetwork)
return;
gh->setMap(msg.readString(16));
- int x = msg.readInt16();
- int y = msg.readInt16();
+ const int x = msg.readInt16();
+ const int y = msg.readInt16();
mapServer.hostname = ipToString(msg.readInt32());
mapServer.port = msg.readInt16();
@@ -169,7 +171,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
const Token &token =
static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
- LocalPlayer *tempPlayer = new LocalPlayer(msg.readInt32(), 0);
+ LocalPlayer *const tempPlayer = new LocalPlayer(msg.readInt32(), 0);
tempPlayer->setGender(token.sex);
PlayerInfoBackend &data = character->data;
@@ -178,14 +180,14 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
Stat &jobStat = data.mStats[JOB];
jobStat.exp = msg.readInt32();
- int temp = msg.readInt32();
+ const int temp = msg.readInt32();
jobStat.base = temp;
jobStat.mod = temp;
- int shoes = msg.readInt16();
- int gloves = msg.readInt16();
- int cape = msg.readInt16();
- int misc1 = msg.readInt16();
+ const int shoes = msg.readInt16();
+ const int gloves = msg.readInt16();
+ const int cape = msg.readInt16();
+ const int misc1 = msg.readInt16();
msg.readInt32(); // option
msg.readInt32(); // karma
@@ -199,23 +201,23 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
msg.readInt16(); // speed
tempPlayer->setSubtype(msg.readInt16()); // class (used for race)
- int hairStyle = msg.readInt16();
- uint16_t weapon = msg.readInt16(); // server not used it. may be need use?
+ const int hairStyle = msg.readInt16();
+ const uint16_t weapon = msg.readInt16(); // server not used it. may be need use?
tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true);
data.mAttributes[PlayerInfo::LEVEL] = msg.readInt16();
msg.readInt16(); // skill point
- int bottomClothes = msg.readInt16();
- int shield = msg.readInt16();
+ const int bottomClothes = msg.readInt16();
+ const int shield = msg.readInt16();
int hat = msg.readInt16(); // head option top
- int topClothes = msg.readInt16();
+ const int topClothes = msg.readInt16();
tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1,
ItemDB::get(-hairStyle).getDyeColorsString(msg.readInt16()));
- int misc2 = msg.readInt16();
+ const int misc2 = msg.readInt16();
tempPlayer->setName(msg.readString(24));
character->dummy = tempPlayer;
@@ -311,7 +313,7 @@ void CharServerHandler::connect()
void CharServerHandler::processCharLogin(Net::MessageIn &msg)
{
msg.skip(2); // Length word
- int slots = msg.readInt16();
+ const int slots = msg.readInt16();
if (slots > 0 && slots < 30)
loginData.characterSlots = static_cast<short unsigned int>(slots);
@@ -321,11 +323,11 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg)
mCharacters.clear();
// Derive number of characters from message length
- int count = (msg.getLength() - 24) / 106;
+ const int count = (msg.getLength() - 24) / 106;
for (int i = 0; i < count; ++i)
{
- Net::Character *character = new Net::Character;
+ Net::Character *const character = new Net::Character;
readPlayerData(msg, character, false);
mCharacters.push_back(character);
if (character && character->dummy)