From 5f03e73484a50c9689956b32ef97630b56d2a00d Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Wed, 29 Dec 2010 07:41:49 +0100 Subject: Made the server handle properly the characters slots. I turned the vector storing character data into a map, keeping the character's slot. Fixed a memleak along the way. Reviewed-by: Crush. --- src/account-server/character.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/account-server/character.h') diff --git a/src/account-server/character.h b/src/account-server/character.h index e43b61a1..a0d4b61c 100644 --- a/src/account-server/character.h +++ b/src/account-server/character.h @@ -50,6 +50,15 @@ class Character int getDatabaseID() const { return mDatabaseID; } void setDatabaseID(int id) { mDatabaseID = id; } + /** + * Gets the slot of the character. + */ + unsigned int getCharacterSlot() const + { return mCharacterSlot; } + + void setCharacterSlot(unsigned int slot) + { mCharacterSlot = slot; } + /** Gets the account the character belongs to. */ Account *getAccount() const { return mAccount; } @@ -234,6 +243,7 @@ class Character Possessions mPossessions; //!< All the possesions of the character. std::string mName; //!< Name of the character. int mDatabaseID; //!< Character database ID. + unsigned int mCharacterSlot; //!< Character slot. int mAccountID; //!< Account ID of the owner. Account *mAccount; //!< Account owning the character. Point mPos; //!< Position the being is at. @@ -270,6 +280,6 @@ class Character /** * Type definition for a list of Characters. */ -typedef std::vector< Character * > Characters; +typedef std::map Characters; #endif -- cgit v1.2.3-60-g2f50