summaryrefslogtreecommitdiffstats
path: root/pacman-c++/sceneholder.cpp
diff options
context:
space:
mode:
authortotycro <totycro@unknown-horizons.org>2011-04-11 12:37:29 +0200
committertotycro <totycro@unknown-horizons.org>2011-04-11 12:37:29 +0200
commit51a3559e5df31018d7de14357f83c24e7e508d7e (patch)
tree89db0899d182dd5b3b770b07c8646dd80c915d4e /pacman-c++/sceneholder.cpp
parent98f4a31e1a359a69dbcc0fa4055f36cefb6d4e02 (diff)
downloadfoop-51a3559e5df31018d7de14357f83c24e7e508d7e.tar.gz
foop-51a3559e5df31018d7de14357f83c24e7e508d7e.tar.bz2
foop-51a3559e5df31018d7de14357f83c24e7e508d7e.zip
progress
Diffstat (limited to 'pacman-c++/sceneholder.cpp')
-rw-r--r--pacman-c++/sceneholder.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/pacman-c++/sceneholder.cpp b/pacman-c++/sceneholder.cpp
index 0a65d19..1596ba1 100644
--- a/pacman-c++/sceneholder.cpp
+++ b/pacman-c++/sceneholder.cpp
@@ -31,12 +31,9 @@ void SceneHolder::updateMap(const Transmission::map_t& map)
31 31
32 Color::Color color = static_cast<Color::Color>(cur & Transmission::color_mask); 32 Color::Color color = static_cast<Color::Color>(cur & Transmission::color_mask);
33 PixmapItem* item = NULL; 33 PixmapItem* item = NULL;
34 if (cur == Transmission::none) 34
35 { 35 if (cur & Transmission::empty)
36 // no update 36 { // special handling for purging field
37 }
38 else if (cur & Transmission::empty)
39 {
40 PixmapItem* oldItem = visualMap[x][y]; 37 PixmapItem* oldItem = visualMap[x][y];
41 // remove elements (in case it's not an actor) 38 // remove elements (in case it's not an actor)
42 if (oldItem != NULL && dynamic_cast<Actor*>(item) == NULL) 39 if (oldItem != NULL && dynamic_cast<Actor*>(item) == NULL)
@@ -44,8 +41,14 @@ void SceneHolder::updateMap(const Transmission::map_t& map)
44 m_scene->removeItem(oldItem); 41 m_scene->removeItem(oldItem);
45 visualMap[x][y] = NULL; 42 visualMap[x][y] = NULL;
46 delete oldItem; 43 delete oldItem;
44 qDebug() << "deleting " << x << y;
47 } 45 }
48 } 46 }
47
48 if (cur == Transmission::none)
49 {
50 // no update
51 }
49 else if (cur & Transmission::block) 52 else if (cur & Transmission::block)
50 { 53 {
51 unsigned int neighbours = Block::None; 54 unsigned int neighbours = Block::None;
@@ -81,7 +84,11 @@ void SceneHolder::updateMap(const Transmission::map_t& map)
81 Actor::Movement direction = 84 Actor::Movement direction =
82 Util::transmissionMovementToActor(cur & Transmission::direction_mask); 85 Util::transmissionMovementToActor(cur & Transmission::direction_mask);
83 actor->move(direction); 86 actor->move(direction);
84 qDebug() << "actor move " << direction; 87 qDebug() << "actor move " << direction << "to " << x << y;
88 }
89 else if (cur & Transmission::empty)
90 {
91 // already handled
85 } 92 }
86 else 93 else
87 { 94 {