summaryrefslogtreecommitdiff
path: root/src/being.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-07-23 00:10:43 +0300
committerAndrei Karas <akaras@inbox.ru>2012-07-23 00:10:43 +0300
commitd97189f055798b5b2051c1c5770a3def62747461 (patch)
treed66a891dba33d2ce1c882e0de7d6145bb2e0326b /src/being.h
parent25dce1399e40f24809842303d48ef090439de1e5 (diff)
downloadmanaverse-d97189f055798b5b2051c1c5770a3def62747461.tar.gz
manaverse-d97189f055798b5b2051c1c5770a3def62747461.tar.bz2
manaverse-d97189f055798b5b2051c1c5770a3def62747461.tar.xz
manaverse-d97189f055798b5b2051c1c5770a3def62747461.zip
Improve perfomance in some object constructors.
Diffstat (limited to 'src/being.h')
-rw-r--r--src/being.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/being.h b/src/being.h
index 289c15e9d..d09e97225 100644
--- a/src/being.h
+++ b/src/being.h
@@ -46,6 +46,9 @@
#define SPEECH_MIN_TIME 200
#define SPEECH_MAX_TIME 800
+static const int DEFAULT_BEING_WIDTH = 32;
+static const int DEFAULT_BEING_HEIGHT = 32;
+
class AnimatedSprite;
class BeingCacheEntry;
class Being;
@@ -539,12 +542,14 @@ class Being : public ActorSprite, public ConfigListener
/**
* Returns the horizontal size of the current base sprite of the being.
*/
- virtual int getWidth() const;
+ virtual int getWidth() const
+ { return std::max(CompoundSprite::getWidth(), DEFAULT_BEING_WIDTH); }
/**
* Returns the vertical size of the current base sprite of the being.
*/
- virtual int getHeight() const;
+ virtual int getHeight() const
+ { return std::max(CompoundSprite::getHeight(), DEFAULT_BEING_HEIGHT); }
/**
* Returns the being's pixel radius used to detect collisions.