From d4edf76ec16c63ad126712ffbe86d8ed63ab70eb Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Sun, 1 Jul 2007 19:41:59 +0000 Subject: Made character data persistent across logout/login. --- src/game-server/accountconnection.cpp | 1 + src/game-server/character.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/game-server') diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp index de1ec618..fa097921 100644 --- a/src/game-server/accountconnection.cpp +++ b/src/game-server/accountconnection.cpp @@ -60,6 +60,7 @@ bool AccountConnection::start() void AccountConnection::sendCharacterData(Character *p) { MessageOut msg(GAMSG_PLAYER_DATA); + msg.writeLong(p->getDatabaseID()); serializeCharacterData(*p, msg); send(msg); } diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp index b9613c1f..4d04c227 100644 --- a/src/game-server/character.cpp +++ b/src/game-server/character.cpp @@ -32,13 +32,15 @@ Character::Character(MessageIn & msg): Being(OBJECT_CHARACTER, 65535), mClient(NULL), mAttributesChanged(true), - mDatabaseID(-1), mName(""), mGender(0), mHairStyle(0), mHairColor(0), + mDatabaseID(-1), mName(), mGender(0), mHairStyle(0), mHairColor(0), mLevel(0), mMoney(0) { // prepare attributes vector mAttributes.resize(NB_ATTRIBUTES_CHAR, 1); mOldAttributes.resize(NB_ATTRIBUTES_CHAR, 0); - // get base attributes + // get character data + mDatabaseID = msg.readLong(); + mName = msg.readString(); deserializeCharacterData(*this, msg); // give the player 10 weapon skill for testing purpose setAttribute(CHAR_SKILL_WEAPON_UNARMED, 10); -- cgit v1.2.3-70-g09d2