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:
parent
241a7f63e1
commit
a637ce6e36
@ -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())
|
||||
{
|
||||
|
@ -320,11 +320,11 @@ void ClientLobbyRoomProtocol::connectionAccepted(Event* event)
|
||||
{
|
||||
if (data[0] != 1 || data[2] != 4)
|
||||
Log::error("ClientLobbyRoomProtocol", "Bad format in players list.");
|
||||
|
||||
|
||||
uint8_t race_id = data[1];
|
||||
uint32_t global_id = data.gui32(3);
|
||||
Online::Profile* new_user = new Online::Profile(global_id, "");
|
||||
|
||||
|
||||
NetworkPlayerProfile* profile2 = new NetworkPlayerProfile();
|
||||
profile2->race_id = race_id;
|
||||
profile2->user_profile = new_user;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -41,7 +41,7 @@ class RaceConfig
|
||||
|
||||
void computeNextTrack();
|
||||
|
||||
const TrackInfo* getNextTrack() const;
|
||||
const TrackInfo* getNextTrackInfo() const;
|
||||
bool getReverse() const;
|
||||
bool getLapCount() const;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user