bool Game::isFinished() { //Inspect victory conditions //Return true if a player has won //Victory conditions are: // 1 - There is only one player surviving // 2 - That player is on the Crown of Command (in the Valley of Fire). return getNumberOfPlayers() == 1 && players[0]->position()->getTitle() == "Valley of Fire" && dynamic_cast<ValleyOfFireTile*>(players[0]->position())->hasCrown(players[0]); }
/*! @brief Returns the RobotInfo structure for the robot with teamNumber and playerNumber. If there is no robot with those numbers NULL is returned */ const RobotInfo* GameInformation::getRobotInfo(int teamNumber, int playerNumber) const { const TeamInfo* team = getTeamInfo(teamNumber); if(team) { if((playerNumber > getNumberOfPlayers()) || (playerNumber <= 0)) return 0; else return &team->players[playerNumber-1]; } else return 0; }