summaryrefslogtreecommitdiff
path: root/src/object.h
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2006-08-06 17:30:40 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2006-08-06 17:30:40 +0000
commit4c15d1d1dcedb3627e501fb5ddba4ae74281968c (patch)
treede4a44e603d05742b4eaffff75b759e1ac6ff85c /src/object.h
parentce849af300a70425b574b724c62dc9f5fce6016b (diff)
downloadmanaserv-4c15d1d1dcedb3627e501fb5ddba4ae74281968c.tar.gz
manaserv-4c15d1d1dcedb3627e501fb5ddba4ae74281968c.tar.bz2
manaserv-4c15d1d1dcedb3627e501fb5ddba4ae74281968c.tar.xz
manaserv-4c15d1d1dcedb3627e501fb5ddba4ae74281968c.zip
Implemented crude handling of being movements.
Diffstat (limited to 'src/object.h')
-rw-r--r--src/object.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/object.h b/src/object.h
index 7c64719f..05b1f45d 100644
--- a/src/object.h
+++ b/src/object.h
@@ -165,6 +165,42 @@ class MovingObject: public Object
MovingObject(int type, int id)
: Object(type, id)
{}
+
+ /**
+ * Gets the destination coordinates of the object.
+ */
+ std::pair<unsigned, unsigned> getDestination() const
+ { return std::make_pair(mDstX, mDstY); }
+
+ /**
+ * Sets the destination coordinates of the object.
+ */
+ void setDestination(unsigned x, unsigned y)
+ { mDstX = x; mDstY = y; }
+
+ /**
+ * Gets the next coordinates of the object.
+ */
+ std::pair<unsigned, unsigned> getNextPosition() const
+ { return std::make_pair(mNewX, mNewY); }
+
+ /**
+ * Sets object speed.
+ */
+ void setSpeed(unsigned s)
+ { mSpeed = s; }
+
+ /**
+ * Moves the object toward its destination.
+ */
+ void move();
+
+ private:
+ unsigned mDstX; /**< target x coordinate */
+ unsigned mDstY; /**< target y coordinate */
+ unsigned mNewX; /**< next x coordinate */
+ unsigned mNewY; /**< next y coordinate */
+ unsigned mSpeed; /**< speed */
};
/**