summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-27 23:50:16 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-27 23:50:16 +0000
commit30063f42cc8d13ed241a52b90e63c2c68599115e (patch)
tree68868a0aa04007a0ad4a62d97556c27b48f057d7 /src/being.cpp
parent0ecae988adfa88cb6b8803a9f5b7215221fceb74 (diff)
downloadmana-30063f42cc8d13ed241a52b90e63c2c68599115e.tar.gz
mana-30063f42cc8d13ed241a52b90e63c2c68599115e.tar.bz2
mana-30063f42cc8d13ed241a52b90e63c2c68599115e.tar.xz
mana-30063f42cc8d13ed241a52b90e63c2c68599115e.zip
autoTarget is now a Being*, also may have fixed related crash and added label
to show current target.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 30e32b7c..e6435487 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -67,8 +67,13 @@ void add_node(Being *being)
void remove_node(unsigned int id)
{
std::list<Being *>::iterator i;
- for (i = beings.begin(); i != beings.end(); i++) {
- if ((*i)->id == id) {
+ for (i = beings.begin(); i != beings.end(); i++)
+ {
+ if ((*i)->id == id)
+ {
+ if (autoTarget == (*i)) {
+ autoTarget = NULL;
+ }
delete (*i);
beings.erase(i);
return;
@@ -302,8 +307,8 @@ void Being::logic()
frame = (get_elapsed_time(walk_time) * 4) / aspd;
if (frame >= 4) {
nextStep();
- if (autoTarget > 0 && this == player_node) {
- attack(findNode(autoTarget));
+ if (autoTarget && this == player_node) {
+ attack(autoTarget);
}
}
break;
@@ -335,9 +340,14 @@ void Being::drawSpeech(Graphics *graphics)
}
if (showDamage) {
graphics->drawText(damage,
- text_x + 60,
- text_y - 60 - get_elapsed_time(damage_time) / 100,
- gcn::Graphics::CENTER);
+ text_x + 60,
+ text_y - 60 - get_elapsed_time(damage_time) / 100,
+ gcn::Graphics::CENTER);
+ }
+ if (this == autoTarget) {
+ graphics->drawText("[TARGET]",
+ text_x + 60, text_y,
+ gcn::Graphics::CENTER);
}
}