diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-08-04 07:20:52 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-08-04 07:20:52 +0000 |
commit | 1ca7028c99319e5dc04cb34c1839b04e3de045f2 (patch) | |
tree | 89347a05dd31ede185210b0a48893431250a1a29 /src/object.h | |
parent | 0c0966322b3018fa5fe3be3f52eef867da6ec779 (diff) | |
download | manaserv-1ca7028c99319e5dc04cb34c1839b04e3de045f2.tar.gz manaserv-1ca7028c99319e5dc04cb34c1839b04e3de045f2.tar.bz2 manaserv-1ca7028c99319e5dc04cb34c1839b04e3de045f2.tar.xz manaserv-1ca7028c99319e5dc04cb34c1839b04e3de045f2.zip |
Added unique ID to Player class.
Diffstat (limited to 'src/object.h')
-rw-r--r-- | src/object.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/object.h b/src/object.h index 77705801..7c64719f 100644 --- a/src/object.h +++ b/src/object.h @@ -40,8 +40,9 @@ class Object /** * Constructor. */ - Object(int type) + Object(int type, int id) : mType(type), + mID(id), mNeedUpdate(false) {} @@ -59,6 +60,20 @@ class Object { return mType; } /** + * Get object ID. + * + * @return the unique ID, a negative number if none yet. + */ + int getID() const + { return mID; } + + /** + * Set object ID. + * The account shall not have any ID yet. + */ + void setID(int id); + + /** * Set the x coordinate. * * @param x the new x coordinate. @@ -129,6 +144,7 @@ class Object private: int mType; /**< Object type */ + int mID; /** Object unique ID (wrt its type and its map at least) */ unsigned int mX; /**< x coordinate */ unsigned int mY; /**< y coordinate */ unsigned int mMapId; /**< id of the map being is on */ @@ -146,8 +162,8 @@ class MovingObject: public Object /** * Proxy constructor. */ - MovingObject(int type) - : Object(type) + MovingObject(int type, int id) + : Object(type, id) {} }; |