diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/being.cpp | 14 | ||||
-rw-r--r-- | src/being.h | 2 | ||||
-rw-r--r-- | src/game.cpp | 2 |
4 files changed, 6 insertions, 13 deletions
@@ -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) { |