diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-09-13 21:41:51 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-09-13 21:41:51 +0000 |
commit | 78771718bf7af14273d7bb0090dccff97b00b397 (patch) | |
tree | 303aef757ae998e3d5a8afb6b5b502381e7252ec /src | |
parent | a68d11c8f32ac8795a27fe3bc27e1943ee6dc813 (diff) | |
download | mana-78771718bf7af14273d7bb0090dccff97b00b397.tar.gz mana-78771718bf7af14273d7bb0090dccff97b00b397.tar.bz2 mana-78771718bf7af14273d7bb0090dccff97b00b397.tar.xz mana-78771718bf7af14273d7bb0090dccff97b00b397.zip |
Simplify remove_node.
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 14 | ||||
-rw-r--r-- | src/being.h | 2 | ||||
-rw-r--r-- | src/game.cpp | 2 |
3 files changed, 5 insertions, 13 deletions
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) { |