summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-09 23:47:02 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-09 23:47:02 +0100
commitfa2f3ac593a792c32095c2e885665ec91bb4019d (patch)
treef44aee845f0229dfcc6b2ad3c74613e0352f36c2 /src/being.cpp
parent07f7d52f661a74e6d0c780ca53e724651e3dcc48 (diff)
parent40edf4e91558cffd83d9015a2cf4a16360e27855 (diff)
downloadmana-fa2f3ac593a792c32095c2e885665ec91bb4019d.tar.gz
mana-fa2f3ac593a792c32095c2e885665ec91bb4019d.tar.bz2
mana-fa2f3ac593a792c32095c2e885665ec91bb4019d.tar.xz
mana-fa2f3ac593a792c32095c2e885665ec91bb4019d.zip
Merged with Aethyra master as of 2009-02-09
Conflicts: A lot of files...
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/being.cpp b/src/being.cpp
index dadc7357..e1ff5591 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -23,7 +23,7 @@
#include "animatedsprite.h"
#include "configuration.h"
-#include "equipment.h"
+#include "effectmanager.h"
#include "game.h"
#include "graphics.h"
#include "localplayer.h"
@@ -34,7 +34,12 @@
#include "text.h"
#include "statuseffect.h"
+#include "gui/speechbubble.h"
+
+#include "resources/colordb.h"
+
#include "resources/emotedb.h"
+#include "resources/image.h"
#include "resources/imageset.h"
#include "resources/itemdb.h"
#include "resources/iteminfo.h"
@@ -44,8 +49,9 @@
#include "gui/speechbubble.h"
#include "utils/dtor.h"
-#include "utils/gettext.h"
-#include "utils/tostring.h"
+#include "utils/gettext.h"
+#include "utils/tostring.h"
+#include "utils/trim.h"
#include "utils/xml.h"
#include <cassert>
@@ -71,7 +77,6 @@ Being::Being(int id, int job, Map *map):
mWalkTime(0),
mEmotion(0), mEmotionTime(0),
mAttackSpeed(350),
- mEquipment(new Equipment()),
mId(id),
mWalkSpeed(150),
mDirection(DOWN),
@@ -183,14 +188,7 @@ void Being::setSpeech(const std::string &text, Uint32 time)
mSpeech = text;
// Trim whitespace
- while (mSpeech[0] == ' ')
- {
- mSpeech = mSpeech.substr(1, mSpeech.size());
- }
- while (mSpeech[mSpeech.size()] == ' ')
- {
- mSpeech = mSpeech.substr(0, mSpeech.size() - 1);
- }
+ trim(mSpeech);
// check for links
std::string::size_type start = mSpeech.find('[');
@@ -206,8 +204,11 @@ void Being::setSpeech(const std::string &text, Uint32 time)
}
std::string::size_type position = mSpeech.find('|');
- mSpeech.erase(end, 1);
- mSpeech.erase(start, (position - start) + 1);
+ if (mSpeech[start + 1] == '@' && mSpeech[start + 2] == '@')
+ {
+ mSpeech.erase(end, 1);
+ mSpeech.erase(start, (position - start) + 1);
+ }
position = mSpeech.find('@');
while (position != std::string::npos)
@@ -221,7 +222,7 @@ void Being::setSpeech(const std::string &text, Uint32 time)
}
if (mSpeech != "")
- mSpeechTime = 500;
+ mSpeechTime = time <= SPEECH_MAX_TIME ? time : SPEECH_MAX_TIME;
}
void Being::takeDamage(int amount)
@@ -519,7 +520,7 @@ void Being::drawEmotion(Graphics *graphics, int offsetX, int offsetY)
emotionSet[emotionIndex]->draw(graphics, px, py);
}
-void Being::drawSpeech(Graphics *graphics, int offsetX, int offsetY)
+void Being::drawSpeech(int offsetX, int offsetY)
{
int px = mPx + offsetX;
int py = mPy + offsetY;