diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-01-03 22:27:31 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-01-03 22:27:31 +0000 |
commit | 2be6f298a1c39dff04070588f75a3bed0c495b8b (patch) | |
tree | 80ef9f32bfe5719b3a4fdda0f2e5d9dfc2891253 /src/graphic | |
parent | ded2bc689849760f1a7cec9f918520dd4598fba4 (diff) | |
download | mana-client-2be6f298a1c39dff04070588f75a3bed0c495b8b.tar.gz mana-client-2be6f298a1c39dff04070588f75a3bed0c495b8b.tar.bz2 mana-client-2be6f298a1c39dff04070588f75a3bed0c495b8b.tar.xz mana-client-2be6f298a1c39dff04070588f75a3bed0c495b8b.zip |
Use a std::list to store the beings (nodes).
Diffstat (limited to 'src/graphic')
-rw-r--r-- | src/graphic/graphic.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index 92acd9be..3640bde0 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -261,8 +261,10 @@ void GraphicEngine::refresh() { } // Draw nodes - NODE *node = get_head(); - while (node) { + std::list<NODE*>::iterator beingIterator = beings.begin(); + while (beingIterator != beings.end()) { + NODE *node = (*beingIterator); + unsigned short x = get_x(node->coordinates); unsigned short y = get_y(node->coordinates); unsigned char dir = get_direction(node->coordinates) / 2; @@ -392,12 +394,11 @@ void GraphicEngine::refresh() { } if (node->action == MONSTER_DEAD && node->frame >= 20) { - NODE *temp = node; - node = node->next; - remove_node(temp->id); + delete node; + beingIterator = beings.erase(beingIterator); } else { - node = node->next; + beingIterator++; } // nodes are ordered so if the next node y is > then the @@ -422,8 +423,10 @@ void GraphicEngine::refresh() { } // Draw player speech - node = get_head(); - while (node) { + beingIterator = beings.begin(); + while (beingIterator != beings.end()) { + NODE *node = (*beingIterator); + if (node->speech != NULL) { if (node->speech_color == makecol(255, 255, 255)) { textprintf_centre_ex(buffer, font, @@ -445,8 +448,9 @@ void GraphicEngine::refresh() { free(node->speech); node->speech = NULL; } - } - node = node->next; + } + + beingIterator++; } set_trans_blender(0, 0, 0, 110); |