From 204f2c3a32779d746f62c5ebaa6aefbaf410da7a Mon Sep 17 00:00:00 2001 From: manuel Date: Sun, 17 Apr 2011 20:44:07 +0200 Subject: more bot stuff --- pacman-c++/server.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'pacman-c++') diff --git a/pacman-c++/server.cpp b/pacman-c++/server.cpp index e42cfbc..a48ee32 100644 --- a/pacman-c++/server.cpp +++ b/pacman-c++/server.cpp @@ -54,6 +54,7 @@ bool Server::run() void Server::tick() { //qDebug() << "[Tick] Doing server update"; + //TODO: add ai here Transmission::map_t map = calculateUpdates(); updateMap(map); @@ -74,10 +75,6 @@ Transmission::map_t Server::calculateUpdates() { Transmission::map_t map = Util::createEmptyMap(); - //TODO: ai - //m_actorMovements[Color::blue] = Actor::Movement((qrand() % 4) + 1); - //m_actorMovements[Color::green] = Actor::Movement((qrand() % 4) + 1); - QMutableMapIterator i(m_actorMovements); while (i.hasNext()) { @@ -293,7 +290,7 @@ bool Server::waitForClientConnections() qDebug() << "[Server] Waiting for clients"; ProtoBuf::Init packet; - for (unsigned int i = 0; i < m_maxplayers; ++i) + for (unsigned int i = 0; i < (m_maxplayers - m_numbots); ++i) { bool connectionAvailable = tcpSrv->waitForNewConnection(-1); Q_ASSERT(connectionAvailable); @@ -310,6 +307,9 @@ bool Server::waitForClientConnections() qDebug() << "[Connect] New Player: color=" << color; } + for (unsigned int i = (m_maxplayers - m_numbots); i < m_maxplayers; ++i) + m_bots.append(Color::order[i]); + qDebug() << "[Server] All Clients connected"; return true; } -- cgit v1.2.3