summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pacman-c++/sceneholder.cpp6
-rw-r--r--pacman-c++/server.cpp2
-rw-r--r--pacman-c++/util.cpp3
3 files changed, 6 insertions, 5 deletions
diff --git a/pacman-c++/sceneholder.cpp b/pacman-c++/sceneholder.cpp
index 4d71a15..37db691 100644
--- a/pacman-c++/sceneholder.cpp
+++ b/pacman-c++/sceneholder.cpp
@@ -152,7 +152,11 @@ void SceneHolder::updateMap(const Transmission::map_t& map, const unsigned int x
152 qDebug() << "[SceneUpdate] actor moves: color=" << color 152 qDebug() << "[SceneUpdate] actor moves: color=" << color
153 << "direction=" << direction << "newpos=" << QPoint(x, y); 153 << "direction=" << direction << "newpos=" << QPoint(x, y);
154 } 154 }
155 actor->setPos(mapPositionToCoord(x, y)); 155
156 QPoint distance = QPoint(x, y) - CoordToMapPosition(actor->pos().x(), actor->pos().y());
157 if (distance.manhattanLength() > 1) {
158 actor->setPos(mapPositionToCoord(x, y));
159 }
156 } 160 }
157 161
158 if (cur & Transmission::empty) 162 if (cur & Transmission::empty)
diff --git a/pacman-c++/server.cpp b/pacman-c++/server.cpp
index cc69f08..1c3caf9 100644
--- a/pacman-c++/server.cpp
+++ b/pacman-c++/server.cpp
@@ -41,7 +41,7 @@ bool Server::run()
41 QTimer *timer2 = new QTimer(this); 41 QTimer *timer2 = new QTimer(this);
42 connect(timer2, SIGNAL(timeout()), this, SLOT(onRoundFinished())); 42 connect(timer2, SIGNAL(timeout()), this, SLOT(onRoundFinished()));
43 timer2->start(3000); 43 timer2->start(3000);
44 / */ 44 // */
45 45
46 connect(this, SIGNAL(allPointsRemoved()), SLOT(onRoundFinished())); 46 connect(this, SIGNAL(allPointsRemoved()), SLOT(onRoundFinished()));
47 47
diff --git a/pacman-c++/util.cpp b/pacman-c++/util.cpp
index fcc1aff..070c716 100644
--- a/pacman-c++/util.cpp
+++ b/pacman-c++/util.cpp
@@ -139,15 +139,12 @@ namespace Util
139 void fillPoints(Transmission::map_t map, Transmission::field_t type) 139 void fillPoints(Transmission::map_t map, Transmission::field_t type)
140 { 140 {
141 /* auto place normal points*/ 141 /* auto place normal points*/
142 int i =0;
143 for (unsigned int x = 0; x < Constants::map_size.width; ++x) 142 for (unsigned int x = 0; x < Constants::map_size.width; ++x)
144 { 143 {
145 for (unsigned int y = 0; y < Constants::map_size.height; ++y) 144 for (unsigned int y = 0; y < Constants::map_size.height; ++y)
146 { 145 {
147 Transmission::field_t &cur = map[x][y]; 146 Transmission::field_t &cur = map[x][y];
148 if (cur == Transmission::none) { 147 if (cur == Transmission::none) {
149 if (++i > 10 ) continue;
150
151 cur = type; 148 cur = type;
152 } else if (cur == Transmission::point) { 149 } else if (cur == Transmission::point) {
153 cur = Transmission::none; 150 cur = Transmission::none;