summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-05-03 01:00:51 +0200
committermanuel <manuel@mausz.at>2011-05-03 01:00:51 +0200
commite54ccad07e256ba877bd41d70bd358bd0085bd1e (patch)
tree4abe7d9af5784ad5f5bfbfc6cdab4c652912875a
parentce94357ba958fd5692eadedab48f1f7d80dc0999 (diff)
downloadfoop-e54ccad07e256ba877bd41d70bd358bd0085bd1e.tar.gz
foop-e54ccad07e256ba877bd41d70bd358bd0085bd1e.tar.bz2
foop-e54ccad07e256ba877bd41d70bd358bd0085bd1e.zip
- add endless wait for players
- add eating order randomization
-rw-r--r--pacman-c++/mainwidget.cpp2
-rw-r--r--pacman-c++/server.cpp7
2 files changed, 7 insertions, 2 deletions
diff --git a/pacman-c++/mainwidget.cpp b/pacman-c++/mainwidget.cpp
index 8745bf9..49ddf7a 100644
--- a/pacman-c++/mainwidget.cpp
+++ b/pacman-c++/mainwidget.cpp
@@ -31,7 +31,7 @@ MainWidget::MainWidget(QWidget *parent)
31 /* wait for the server to send the first map update (initial map) 31 /* wait for the server to send the first map update (initial map)
32 * WARNING: this will block the gui 32 * WARNING: this will block the gui
33 */ 33 */
34 m_socket->waitForReadyRead(); 34 m_socket->waitForReadyRead(-1);
35 tick(); 35 tick();
36 36
37 qDebug() << "[Connect] mycolor=" << m_scene->color(); 37 qDebug() << "[Connect] mycolor=" << m_scene->color();
diff --git a/pacman-c++/server.cpp b/pacman-c++/server.cpp
index 962d1bf..2311c81 100644
--- a/pacman-c++/server.cpp
+++ b/pacman-c++/server.cpp
@@ -24,7 +24,7 @@ bool Server::run()
24 /* create eating order list first - this can also be created dynamically per round (theoretically) */ 24 /* create eating order list first - this can also be created dynamically per round (theoretically) */
25 for(unsigned int i = 0; i < m_maxplayers; ++i) 25 for(unsigned int i = 0; i < m_maxplayers; ++i)
26 m_eatingorder.append(Color::order[i]); 26 m_eatingorder.append(Color::order[i]);
27 m_eatingorder.append(Color::order[0]); 27 m_eatingorder.append(m_eatingorder.at(0));
28 28
29 m_tickTimer = new QTimer(this); 29 m_tickTimer = new QTimer(this);
30 m_tickTimer->setInterval(Constants::tick); 30 m_tickTimer->setInterval(Constants::tick);
@@ -604,6 +604,11 @@ void Server::initRoundMap()
604 /* reset scene and clean up items */ 604 /* reset scene and clean up items */
605 reset(); 605 reset();
606 606
607 /* randomize color eating order */
608 m_eatingorder.removeLast();
609 random_shuffle(m_eatingorder.begin(), m_eatingorder.end());
610 m_eatingorder.append(m_eatingorder.at(0));
611
607 /* create new map */ 612 /* create new map */
608 Transmission::map_t map = Util::createDemoMap(); 613 Transmission::map_t map = Util::createDemoMap();
609 Util::placeActors(map, m_maxplayers, Color::order); 614 Util::placeActors(map, m_maxplayers, Color::order);