diff options
| -rw-r--r-- | pacman-c++/server.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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() | |||
| 54 | void Server::tick() | 54 | void Server::tick() |
| 55 | { | 55 | { |
| 56 | //qDebug() << "[Tick] Doing server update"; | 56 | //qDebug() << "[Tick] Doing server update"; |
| 57 | //TODO: add ai here | ||
| 57 | Transmission::map_t map = calculateUpdates(); | 58 | Transmission::map_t map = calculateUpdates(); |
| 58 | updateMap(map); | 59 | updateMap(map); |
| 59 | 60 | ||
| @@ -74,10 +75,6 @@ Transmission::map_t Server::calculateUpdates() | |||
| 74 | { | 75 | { |
| 75 | Transmission::map_t map = Util::createEmptyMap(); | 76 | Transmission::map_t map = Util::createEmptyMap(); |
| 76 | 77 | ||
| 77 | //TODO: ai | ||
| 78 | //m_actorMovements[Color::blue] = Actor::Movement((qrand() % 4) + 1); | ||
| 79 | //m_actorMovements[Color::green] = Actor::Movement((qrand() % 4) + 1); | ||
| 80 | |||
| 81 | QMutableMapIterator<Color::Color, Actor::Movement> i(m_actorMovements); | 78 | QMutableMapIterator<Color::Color, Actor::Movement> i(m_actorMovements); |
| 82 | while (i.hasNext()) | 79 | while (i.hasNext()) |
| 83 | { | 80 | { |
| @@ -293,7 +290,7 @@ bool Server::waitForClientConnections() | |||
| 293 | 290 | ||
| 294 | qDebug() << "[Server] Waiting for clients"; | 291 | qDebug() << "[Server] Waiting for clients"; |
| 295 | ProtoBuf::Init packet; | 292 | ProtoBuf::Init packet; |
| 296 | for (unsigned int i = 0; i < m_maxplayers; ++i) | 293 | for (unsigned int i = 0; i < (m_maxplayers - m_numbots); ++i) |
| 297 | { | 294 | { |
| 298 | bool connectionAvailable = tcpSrv->waitForNewConnection(-1); | 295 | bool connectionAvailable = tcpSrv->waitForNewConnection(-1); |
| 299 | Q_ASSERT(connectionAvailable); | 296 | Q_ASSERT(connectionAvailable); |
| @@ -310,6 +307,9 @@ bool Server::waitForClientConnections() | |||
| 310 | qDebug() << "[Connect] New Player: color=" << color; | 307 | qDebug() << "[Connect] New Player: color=" << color; |
| 311 | } | 308 | } |
| 312 | 309 | ||
| 310 | for (unsigned int i = (m_maxplayers - m_numbots); i < m_maxplayers; ++i) | ||
| 311 | m_bots.append(Color::order[i]); | ||
| 312 | |||
| 313 | qDebug() << "[Server] All Clients connected"; | 313 | qDebug() << "[Server] All Clients connected"; |
| 314 | return true; | 314 | return true; |
| 315 | } | 315 | } |
