Removed hardcoded maximum number of players.

This commit is contained in:
hiker 2015-10-28 08:03:05 +11:00
parent 60bbfe3ab3
commit 7e202d94a8
4 changed files with 6 additions and 5 deletions

View File

@ -49,7 +49,6 @@ ClientLobbyRoomProtocol::~ClientLobbyRoomProtocol()
void ClientLobbyRoomProtocol::setup()
{
m_setup = STKHost::get()->setupNewGame(); // create a new setup
m_setup->getRaceConfig()->setPlayerCount(16); //FIXME : this has to be changed when logging into the server
m_state = NONE;
} // setup

View File

@ -204,12 +204,13 @@ RaceConfig::RaceConfig()
}
//-----------------------------------------------------------------------------
void RaceConfig::setPlayerCount(uint8_t count)
/** Sets the maximum number of players.
*/
void RaceConfig::setMaxPlayerCount(uint8_t count)
{
m_max_players = count;
m_votes.resize(m_max_players);
}
} // setMaxPlayerCount
//-----------------------------------------------------------------------------

View File

@ -86,7 +86,7 @@ class RaceConfig
public:
RaceConfig();
void setPlayerCount(uint8_t count);
void setMaxPlayerCount(uint8_t count);
void setPlayerMajorVote(uint8_t player_id, uint8_t major);
void setPlayerRaceCountVote(uint8_t player_id, uint8_t count);
void setPlayerMinorVote(uint8_t player_id, uint8_t minor);

View File

@ -132,6 +132,7 @@ GameSetup* STKHost::setupNewGame()
if (m_game_setup)
delete m_game_setup;
m_game_setup = new GameSetup();
m_game_setup->getRaceConfig()->setMaxPlayerCount(m_max_players);
return m_game_setup;
} // setupNewGame