summaryrefslogtreecommitdiff
path: root/src/account-server/serverhandler.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-01-04 17:36:52 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-01-04 17:36:52 +0000
commitbbdbb95d5d477b9934bf27cb45c53afbabb2db78 (patch)
treedfb4c50bc1fe530be28434dc096e854ab9db43d8 /src/account-server/serverhandler.cpp
parent8904c9451e4caf22ca81c5bb38e51d6efb0c6355 (diff)
downloadmanaserv-bbdbb95d5d477b9934bf27cb45c53afbabb2db78.tar.gz
manaserv-bbdbb95d5d477b9934bf27cb45c53afbabb2db78.tar.bz2
manaserv-bbdbb95d5d477b9934bf27cb45c53afbabb2db78.tar.xz
manaserv-bbdbb95d5d477b9934bf27cb45c53afbabb2db78.zip
Started serializing character possessions. Reduced their memory footprint.
Diffstat (limited to 'src/account-server/serverhandler.cpp')
-rw-r--r--src/account-server/serverhandler.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/account-server/serverhandler.cpp b/src/account-server/serverhandler.cpp
index 2a1af5ee..b7e51bce 100644
--- a/src/account-server/serverhandler.cpp
+++ b/src/account-server/serverhandler.cpp
@@ -75,18 +75,8 @@ void ServerHandler::registerGameClient(std::string const &token, PlayerPtr ptr)
MessageOut msg(AGMSG_PLAYER_ENTER);
msg.writeLong(ptr->getDatabaseID());
msg.writeString(ptr->getName());
- msg.writeByte(ptr->getGender());
- msg.writeByte(ptr->getHairStyle());
- msg.writeByte(ptr->getHairColor());
- msg.writeByte(ptr->getLevel());
- msg.writeShort(ptr->getMoney());
- for (int j = 0; j < NB_RSTAT; ++j)
- msg.writeShort(ptr->getRawStat(j));
- Point pos = ptr->getPos();
- msg.writeShort(pos.x);
- msg.writeShort(pos.y);
- msg.writeShort(mapId);
msg.writeString(token, 32);
+ ptr->serialize(msg);
Servers::const_iterator i = servers.find(mapId);
assert(i != servers.end());
i->second.server->send(msg);
@@ -130,18 +120,7 @@ void ServerHandler::processMessage(NetComputer *comp, MessageIn &msg)
int id = msg.readLong();
Storage &store = Storage::instance("tmw");
PlayerPtr ptr = store.getCharacter(id);
- ptr->setGender(msg.readByte());
- ptr->setHairStyle(msg.readByte());
- ptr->setHairColor(msg.readByte());
- ptr->setLevel(msg.readByte());
- ptr->setMoney(msg.readShort());
- for (int j = 0; j < NB_RSTAT; ++j)
- ptr->setRawStat(j, msg.readShort());
- int x = msg.readShort();
- int y = msg.readShort();
- Point pos = { x, y };
- ptr->setPos(pos);
- ptr->setMap(msg.readShort());
+ ptr->deserialize(msg);
} break;
case GAMSG_REDIRECT: