summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-09-13 21:41:51 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-09-13 21:41:51 +0000
commit78771718bf7af14273d7bb0090dccff97b00b397 (patch)
tree303aef757ae998e3d5a8afb6b5b502381e7252ec
parenta68d11c8f32ac8795a27fe3bc27e1943ee6dc813 (diff)
downloadmana-78771718bf7af14273d7bb0090dccff97b00b397.tar.gz
mana-78771718bf7af14273d7bb0090dccff97b00b397.tar.bz2
mana-78771718bf7af14273d7bb0090dccff97b00b397.tar.xz
mana-78771718bf7af14273d7bb0090dccff97b00b397.zip
Simplify remove_node.
-rw-r--r--ChangeLog1
-rw-r--r--src/being.cpp14
-rw-r--r--src/being.h2
-rw-r--r--src/game.cpp2
4 files changed, 6 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 58d461e2..75de5af1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
2005-09-13 Björn Steinbrink <B.Steinbrink@gmx.de>
+ * src/being.cpp, src/being.h, src/game.cpp: Simplify remove_node.
* src/being.cpp, src/being.h, src/game.cpp: Merged createBeing and
add_node into createBeing.
* src/main.cpp, src/main.h, src/gui/char_select.cpp,
diff --git a/src/being.cpp b/src/being.cpp
index 579ad54f..2bb0beff 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -91,18 +91,10 @@ Being* createBeing(unsigned int id, unsigned short job, Map *map)
return being;
}
-void remove_node(unsigned int id)
+void remove_node(Being *being)
{
- std::list<Being *>::iterator i;
- for (i = beings.begin(); i != beings.end(); i++)
- {
- if ((*i)->getId() == id)
- {
- delete (*i);
- beings.erase(i);
- return;
- }
- }
+ delete being;
+ beings.remove(being);
}
Being *findNode(unsigned int id)
diff --git a/src/being.h b/src/being.h
index 3b9e0d93..2a9a8421 100644
--- a/src/being.h
+++ b/src/being.h
@@ -245,7 +245,7 @@ Being *findNode(unsigned short x, unsigned short y, Being::Type type);
Being *createBeing(unsigned int id, unsigned short job, Map *map);
/** Remove a Being */
-void remove_node(unsigned int id);
+void remove_node(Being *being);
/** Find a NPC id based on its coordinates */
unsigned int findNpc(unsigned short x, unsigned short y);
diff --git a/src/game.cpp b/src/game.cpp
index 54f900b1..c2620742 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1089,7 +1089,7 @@ void do_parse()
//remove_node(RFIFOL(2));
}
else {
- remove_node(RFIFOL(2));
+ remove_node(being);
}
if (being == autoTarget) {