summaryrefslogtreecommitdiff
path: root/src/account-server/character.h
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-12-29 07:41:49 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-12-29 07:41:49 +0100
commit5f03e73484a50c9689956b32ef97630b56d2a00d (patch)
treeca6d3d7467d4582a2f64be4a45c056f55642fd17 /src/account-server/character.h
parent4ead8e0b6af924132a6fb227325a868db0df335c (diff)
downloadmanaserv-5f03e73484a50c9689956b32ef97630b56d2a00d.tar.gz
manaserv-5f03e73484a50c9689956b32ef97630b56d2a00d.tar.bz2
manaserv-5f03e73484a50c9689956b32ef97630b56d2a00d.tar.xz
manaserv-5f03e73484a50c9689956b32ef97630b56d2a00d.zip
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.
Diffstat (limited to 'src/account-server/character.h')
-rw-r--r--src/account-server/character.h12
1 files changed, 11 insertions, 1 deletions
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<unsigned int, Character* > Characters;
#endif