diff options
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) {} }; |