bool Server::handlePacket() {
  sf::Packet in;

  for(auto &player : players){
     bool isT = isTurn(player->id);
     std::cout << "ID: " << player->id << "Is T: " << isT << std::endl;
     if (isTurn(player->id)) {
      if(player->socket.receive(in) == sf::Socket::Done ){
        std::cout << "got packet" << std::endl;
        return handlePacket(in, *player);
      }
    }
  }

  return true;
}
 bool TurnController::beginTurn(Magican* i_char, int i_status)
 {
     if(!isTurn(i_char, i_status))
         return false;
     
     if(d_turn)
         d_turn->setActive(false);
     d_turn = i_char;
     d_turn->setActive(true);
     return true;
 }
Beispiel #3
0
void GameCycle::assertTurn() const
{
    if (!isTurn())
        throw BadGamePlayStateException(m_state, GAMEPLAYSTATE_TURN);
}
 bool TurnController::isTurn(int i_status)
 {
     return isTurn(d_turn, i_status);
 }