some buxfixes + implementation of the max player count

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@14127 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hilnius 2013-09-21 20:56:39 +00:00
parent 241a7f63e1
commit a637ce6e36
7 changed files with 16 additions and 34 deletions

View File

@ -1422,6 +1422,9 @@ int main(int argc, char *argv[] )
// load the network manager
// If the server has been created (--server option), this will do nothing (just a warning):
NetworkManager::getInstance<ClientNetworkManager>();
if (NetworkManager::getInstance()->isServer())
ServerNetworkManager::getInstance()->setMaxPlayers(
UserConfigParams::m_server_max_players);
NetworkManager::getInstance()->run();
if (NetworkManager::getInstance()->isServer())
{

View File

@ -334,7 +334,8 @@ void ServerLobbyRoomProtocol::connectionRequested(Event* event)
uint32_t player_id = 0;
player_id = data.getUInt32(1);
// can we add the player ?
if (m_setup->getPlayerCount() < 16) // accept player
if (m_setup->getPlayerCount() <
ServerNetworkManager::getInstance()->getMaxPlayers()) //accept
{
// add the player to the game setup
m_next_id = m_setup->getPlayerCount();

View File

@ -44,19 +44,6 @@ void TrackVote::voteLaps(int laps)
track_info.laps = laps;
has_voted_laps = true;
}
//-----------------------------------------------------------------------------
int GPRaceInfo::getMajorMode()
{
return RaceManager::MAJOR_MODE_GRAND_PRIX;
}
//-----------------------------------------------------------------------------
int SingleRaceInfo::getMajorMode()
{
return RaceManager::MAJOR_MODE_SINGLE;
}
//-----------------------------------------------------------------------------
@ -147,23 +134,9 @@ void RaceConfig::computeNextTrack()
//-----------------------------------------------------------------------------
const TrackInfo* RaceConfig::getNextTrack() const
const TrackInfo* RaceConfig::getNextTrackInfo() const
{
return m_track.track;
}
//-----------------------------------------------------------------------------
bool RaceConfig::getReverse() const
{
return m_track.track;
}
//-----------------------------------------------------------------------------
bool RaceConfig::getLapCount() const
{
return m_track.track;
return &m_track;
}
//-----------------------------------------------------------------------------

View File

@ -41,7 +41,7 @@ class RaceConfig
void computeNextTrack();
const TrackInfo* getNextTrack() const;
const TrackInfo* getNextTrackInfo() const;
bool getReverse() const;
bool getLapCount() const;

View File

@ -36,6 +36,9 @@ class ServerNetworkManager : public NetworkManager
virtual void run();
void setMaxPlayers(uint8_t count) { m_max_players = count; }
uint8_t getMaxPlayers() {return m_max_players;}
void kickAllPlayers();
virtual void sendPacket(const NetworkString& data, bool reliable = true);
@ -47,6 +50,7 @@ class ServerNetworkManager : public NetworkManager
virtual ~ServerNetworkManager();
pthread_t* m_thread_keyboard;
uint8_t m_max_players;
};

View File

@ -170,7 +170,8 @@ void STKHost::stopListening()
if(m_listening_thread)
{
pthread_mutex_unlock(&m_exit_mutex); // will stop the update function on its next update
pthread_join(*m_listening_thread, NULL); // wait the thread to end }
pthread_join(*m_listening_thread, NULL); // wait the thread to end
}
}
// ----------------------------------------------------------------------------