summaryrefslogtreecommitdiff
path: root/src/being.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/being.h')
-rw-r--r--src/being.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/being.h b/src/being.h
index 45cfb15d..db6afbb8 100644
--- a/src/being.h
+++ b/src/being.h
@@ -278,13 +278,13 @@ class Being : public Sprite
* Get the current X pixel offset.
*/
int
- getXOffset() const;
+ getXOffset() const { return getOffset(LEFT, RIGHT); }
/**
* Get the current Y pixel offset.
*/
int
- getYOffset() const;
+ getYOffset() const { return getOffset(UP, DOWN); }
protected:
/**
@@ -293,6 +293,12 @@ class Being : public Sprite
void
setPath(std::list<PATH_NODE> path);
+ /**
+ * Calculates the offset in the given directions.
+ * If walking in direction 'neg' the value is negated.
+ */
+ int getOffset(char pos, char neg) const;
+
Uint32 mId; /**< Unique sprite id */
Uint16 mWeapon; /**< Weapon picture id */
Uint16 mWalkSpeed; /**< Walking speed */