From 7e202d94a8c745bea36bcb9607a6b296b1cd04aa Mon Sep 17 00:00:00 2001 From: hiker Date: Wed, 28 Oct 2015 08:03:05 +1100 Subject: [PATCH] Removed hardcoded maximum number of players. --- src/network/protocols/client_lobby_room_protocol.cpp | 1 - src/network/race_config.cpp | 7 ++++--- src/network/race_config.hpp | 2 +- src/network/stk_host.cpp | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/network/protocols/client_lobby_room_protocol.cpp b/src/network/protocols/client_lobby_room_protocol.cpp index cc4060156..0847cf244 100644 --- a/src/network/protocols/client_lobby_room_protocol.cpp +++ b/src/network/protocols/client_lobby_room_protocol.cpp @@ -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 diff --git a/src/network/race_config.cpp b/src/network/race_config.cpp index c6d112787..8c51a4d0b 100644 --- a/src/network/race_config.cpp +++ b/src/network/race_config.cpp @@ -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 //----------------------------------------------------------------------------- diff --git a/src/network/race_config.hpp b/src/network/race_config.hpp index f721e5064..f291cebf8 100644 --- a/src/network/race_config.hpp +++ b/src/network/race_config.hpp @@ -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); diff --git a/src/network/stk_host.cpp b/src/network/stk_host.cpp index aeac2c68b..a6d6f8ef1 100644 --- a/src/network/stk_host.cpp +++ b/src/network/stk_host.cpp @@ -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