Show player count with AI in server browser
This commit is contained in:
parent
1614868b5d
commit
cf412c947c
@ -537,6 +537,7 @@ void ServerLobby::setup()
|
|||||||
m_winner_peer_id = 0;
|
m_winner_peer_id = 0;
|
||||||
m_client_starting_time = 0;
|
m_client_starting_time = 0;
|
||||||
m_ai_count = 0;
|
m_ai_count = 0;
|
||||||
|
m_lobby_players.store(0);
|
||||||
auto players = STKHost::get()->getPlayersForNewGame();
|
auto players = STKHost::get()->getPlayersForNewGame();
|
||||||
if (m_game_setup->isGrandPrix() && !m_game_setup->isGrandPrixStarted())
|
if (m_game_setup->isGrandPrix() && !m_game_setup->isGrandPrixStarted())
|
||||||
{
|
{
|
||||||
@ -2302,8 +2303,7 @@ void ServerLobby::checkIncomingConnectionRequests()
|
|||||||
const TransportAddress &addr = STKHost::get()->getPublicAddress();
|
const TransportAddress &addr = STKHost::get()->getPublicAddress();
|
||||||
request->addParameter("address", addr.getIP() );
|
request->addParameter("address", addr.getIP() );
|
||||||
request->addParameter("port", addr.getPort());
|
request->addParameter("port", addr.getPort());
|
||||||
request->addParameter("current-players",
|
request->addParameter("current-players", getLobbyPlayers());
|
||||||
STKHost::get()->getTotalPlayers());
|
|
||||||
request->addParameter("game-started",
|
request->addParameter("game-started",
|
||||||
m_state.load() == WAITING_FOR_START_GAME ? 0 : 1);
|
m_state.load() == WAITING_FOR_START_GAME ? 0 : 1);
|
||||||
Track* current_track = getPlayingTrack();
|
Track* current_track = getPlayingTrack();
|
||||||
@ -3209,6 +3209,7 @@ void ServerLobby::updatePlayerList(bool update_when_reset_server)
|
|||||||
all_profiles.insert(all_profiles.end(), ai_profiles.begin(),
|
all_profiles.insert(all_profiles.end(), ai_profiles.begin(),
|
||||||
ai_profiles.end());
|
ai_profiles.end());
|
||||||
}
|
}
|
||||||
|
m_lobby_players.store((int)all_profiles.size());
|
||||||
|
|
||||||
NetworkString* pl = getNetworkString();
|
NetworkString* pl = getNetworkString();
|
||||||
pl->setSynchronous(true);
|
pl->setSynchronous(true);
|
||||||
|
@ -191,6 +191,8 @@ private:
|
|||||||
|
|
||||||
std::atomic<int> m_game_mode;
|
std::atomic<int> m_game_mode;
|
||||||
|
|
||||||
|
std::atomic<int> m_lobby_players;
|
||||||
|
|
||||||
std::atomic<uint64_t> m_last_success_poll_time;
|
std::atomic<uint64_t> m_last_success_poll_time;
|
||||||
|
|
||||||
uint64_t m_server_started_at, m_server_delay;
|
uint64_t m_server_started_at, m_server_delay;
|
||||||
@ -351,6 +353,7 @@ public:
|
|||||||
float getStartupBoostOrPenaltyForKart(uint32_t ping, unsigned kart_id);
|
float getStartupBoostOrPenaltyForKart(uint32_t ping, unsigned kart_id);
|
||||||
int getDifficulty() const { return m_difficulty.load(); }
|
int getDifficulty() const { return m_difficulty.load(); }
|
||||||
int getGameMode() const { return m_game_mode.load(); }
|
int getGameMode() const { return m_game_mode.load(); }
|
||||||
|
int getLobbyPlayers() const { return m_lobby_players.load(); }
|
||||||
void saveInitialItems();
|
void saveInitialItems();
|
||||||
void saveIPBanTable(const TransportAddress& addr);
|
void saveIPBanTable(const TransportAddress& addr);
|
||||||
void listBanTable();
|
void listBanTable();
|
||||||
|
@ -1329,7 +1329,7 @@ void STKHost::handleDirectSocketRequest(Network* direct_socket,
|
|||||||
s.addUInt32(ServerConfig::m_server_version);
|
s.addUInt32(ServerConfig::m_server_version);
|
||||||
s.encodeString(name);
|
s.encodeString(name);
|
||||||
s.addUInt8((uint8_t)ServerConfig::m_server_max_players);
|
s.addUInt8((uint8_t)ServerConfig::m_server_max_players);
|
||||||
s.addUInt8((uint8_t)getTotalPlayers());
|
s.addUInt8((uint8_t)sl->getLobbyPlayers());
|
||||||
s.addUInt16(m_private_port);
|
s.addUInt16(m_private_port);
|
||||||
s.addUInt8((uint8_t)sl->getDifficulty());
|
s.addUInt8((uint8_t)sl->getDifficulty());
|
||||||
s.addUInt8((uint8_t)sl->getGameMode());
|
s.addUInt8((uint8_t)sl->getGameMode());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user