summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-03 22:27:31 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-03 22:27:31 +0000
commit2be6f298a1c39dff04070588f75a3bed0c495b8b (patch)
tree80ef9f32bfe5719b3a4fdda0f2e5d9dfc2891253 /src/map.cpp
parentded2bc689849760f1a7cec9f918520dd4598fba4 (diff)
downloadmana-2be6f298a1c39dff04070588f75a3bed0c495b8b.tar.gz
mana-2be6f298a1c39dff04070588f75a3bed0c495b8b.tar.bz2
mana-2be6f298a1c39dff04070588f75a3bed0c495b8b.tar.xz
mana-2be6f298a1c39dff04070588f75a3bed0c495b8b.zip
Use a std::list to store the beings (nodes).
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 0687dd53..ec796768 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -52,16 +52,17 @@ void set_walk(short x_c, short y_c, bool walkable) {
}
bool get_walk(short x_c, short y_c) {
- bool ret = (tiled_map.tiles[x_c][y_c].data[3] & 0x0002)>0;
- if(ret==true) {
- NODE *node = get_head();
- while(node && ret==true) {
- if(get_x(node->coordinates)==x_c && get_y(node->coordinates)==y_c)
- ret = false;
- node = node->next;
- }
- return ret;
- } else return false;
+ bool ret = (tiled_map.tiles[x_c][y_c].data[3] & 0x0002)>0;
+ if (ret == true) {
+ std::list<NODE*>::iterator i = beings.begin();
+ while (i != beings.end() && ret == true) {
+ NODE *node = (*i);
+ if (get_x(node->coordinates)==x_c && get_y(node->coordinates)==y_c)
+ ret = false;
+ i++;
+ }
+ return ret;
+ } else return false;
}
unsigned char get_path_walk(unsigned short x, unsigned short y) {