From 9ac2b59da5a900c000e2bdd52d72c5c874f75fbb Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 19 Apr 2011 22:35:35 +0200 Subject: coding conventions --- pacman-c++/server.cpp | 54 ++++++--------------------------------------------- 1 file changed, 6 insertions(+), 48 deletions(-) (limited to 'pacman-c++/server.cpp') diff --git a/pacman-c++/server.cpp b/pacman-c++/server.cpp index 1c3caf9..39a6ee7 100644 --- a/pacman-c++/server.cpp +++ b/pacman-c++/server.cpp @@ -37,14 +37,6 @@ bool Server::run() connect(m_tickTimer, SIGNAL(timeout()), this, SLOT(tick())); m_tickTimer->start(Constants::tick); - /* finish round every 3 sec - QTimer *timer2 = new QTimer(this); - connect(timer2, SIGNAL(timeout()), this, SLOT(onRoundFinished())); - timer2->start(3000); - // */ - - connect(this, SIGNAL(allPointsRemoved()), SLOT(onRoundFinished())); - return true; } @@ -492,57 +484,22 @@ void Server::keyPressUpdate() void Server::onRoundFinished() { - foreach(Actor *actor, m_actors) { + foreach(Actor *actor, m_actors) actor->finishRound(); - } initRoundMap(); ++m_curRound; - if(m_curRound >= m_rounds) { - // end of game + /* end of game */ + if(m_curRound >= m_rounds) m_tickTimer->stop(); - } } void Server::initRoundMap(bool firstPacket) { - disconnect(this, SIGNAL(allPointsRemoved()), this, SLOT(onRoundFinished())); - if (!firstPacket) { - // clear old map - for (unsigned int i=0; i(e) == NULL) { - removeItem(e); - delete e; - } - } - visualMap[i][j] = 0; - } - } - } - - // create new map + /* create new map */ Transmission::map_t map = Util::createDemoMap(); - // add content Util::placeActors(map, m_maxplayers, Color::order); - /* - if (!firstPacket) { - for (unsigned int i=0; i(map[i][j] & Transmission::color_mask); - Actor *actor = m_actors.value(color, NULL); - qDebug() << "setting actor to " << i << j << mapPositionToCoord(i, j); - actor->setPos(mapPositionToCoord(i, j)); - } - } - } - } - */ - Util::fillPoints(map); /* save positions of blocks for later usage */ @@ -562,7 +519,8 @@ void Server::initRoundMap(bool firstPacket) Util::deleteMap(map); map = NULL; - connect(this, SIGNAL(allPointsRemoved()), this, SLOT(onRoundFinished())); + if (firstPacket) + connect(this, SIGNAL(allPointsRemoved()), this, SLOT(onRoundFinished())); } bool Server::parseCommandline() -- cgit v1.2.3