Clean up network local player handling
This commit is contained in:
parent
82a396ed56
commit
448ad5abcf
@ -46,9 +46,6 @@ private:
|
|||||||
/** Information about all connected players. */
|
/** Information about all connected players. */
|
||||||
std::vector<std::weak_ptr<NetworkPlayerProfile> > m_players;
|
std::vector<std::weak_ptr<NetworkPlayerProfile> > m_players;
|
||||||
|
|
||||||
/** Stores the number of local players. */
|
|
||||||
int m_num_local_players;
|
|
||||||
|
|
||||||
std::vector<std::string> m_tracks;
|
std::vector<std::string> m_tracks;
|
||||||
|
|
||||||
unsigned m_laps;
|
unsigned m_laps;
|
||||||
@ -61,7 +58,6 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
GameSetup()
|
GameSetup()
|
||||||
{
|
{
|
||||||
m_num_local_players = 0;
|
|
||||||
m_extra_server_info = -1;
|
m_extra_server_info = -1;
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
@ -73,12 +69,6 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void update(bool remove_disconnected_players);
|
void update(bool remove_disconnected_players);
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Sets the number of local players. */
|
|
||||||
void setNumLocalPlayers(int n) { m_num_local_players = n; }
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
/** Returns the nunber of local players. */
|
|
||||||
int getNumLocalPlayers() const { return m_num_local_players; }
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
/** \brief Get the players that are / were in the game
|
/** \brief Get the players that are / were in the game
|
||||||
* \return A vector containing pointers on the players profiles. */
|
* \return A vector containing pointers on the players profiles. */
|
||||||
const std::vector<std::weak_ptr<NetworkPlayerProfile> >& getPlayers() const
|
const std::vector<std::weak_ptr<NetworkPlayerProfile> >& getPlayers() const
|
||||||
|
@ -411,8 +411,6 @@ void ClientLobby::connectionAccepted(Event* event)
|
|||||||
|
|
||||||
STKHost::get()->setMyHostId(data.getUInt32());
|
STKHost::get()->setMyHostId(data.getUInt32());
|
||||||
assert(!NetworkConfig::get()->isAddingNetworkPlayers());
|
assert(!NetworkConfig::get()->isAddingNetworkPlayers());
|
||||||
m_game_setup->setNumLocalPlayers((int)
|
|
||||||
NetworkConfig::get()->getNetworkPlayers().size());
|
|
||||||
// connection token
|
// connection token
|
||||||
uint32_t token = data.getToken();
|
uint32_t token = data.getToken();
|
||||||
peer->setClientServerToken(token);
|
peer->setClientServerToken(token);
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "input/device_manager.hpp"
|
#include "input/device_manager.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
#include "network/game_setup.hpp"
|
#include "network/game_setup.hpp"
|
||||||
|
#include "network/network_config.hpp"
|
||||||
#include "network/network_player_profile.hpp"
|
#include "network/network_player_profile.hpp"
|
||||||
#include "network/protocols/game_protocol.hpp"
|
#include "network/protocols/game_protocol.hpp"
|
||||||
#include "network/protocols/game_events_protocol.hpp"
|
#include "network/protocols/game_events_protocol.hpp"
|
||||||
@ -90,7 +91,7 @@ void LobbyProtocol::configRemoteKart(
|
|||||||
|
|
||||||
// Set number of global and local players.
|
// Set number of global and local players.
|
||||||
race_manager->setNumPlayers((int)players.size(),
|
race_manager->setNumPlayers((int)players.size(),
|
||||||
m_game_setup->getNumLocalPlayers());
|
(int)NetworkConfig::get()->getNetworkPlayers().size());
|
||||||
|
|
||||||
// Create the kart information for the race manager:
|
// Create the kart information for the race manager:
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
|
@ -126,11 +126,10 @@ void ServerLobby::setup()
|
|||||||
m_available_kts.second = { all_t.begin(), all_t.end() };
|
m_available_kts.second = { all_t.begin(), all_t.end() };
|
||||||
|
|
||||||
m_server_registered = false;
|
m_server_registered = false;
|
||||||
m_game_setup->setNumLocalPlayers(0); // no local players on a server
|
m_server_has_loaded_world.store(false);
|
||||||
|
|
||||||
// Initialise the data structures to detect if all clients and
|
// Initialise the data structures to detect if all clients and
|
||||||
// the server are ready:
|
// the server are ready:
|
||||||
m_server_has_loaded_world.store(false);
|
|
||||||
resetPeersReady();
|
resetPeersReady();
|
||||||
m_peers_votes.clear();
|
m_peers_votes.clear();
|
||||||
m_server_delay = 0.0;
|
m_server_delay = 0.0;
|
||||||
|
@ -76,6 +76,7 @@ RaceManager::RaceManager()
|
|||||||
m_coin_target = 0;
|
m_coin_target = 0;
|
||||||
m_started_from_overworld = false;
|
m_started_from_overworld = false;
|
||||||
m_have_kart_last_position_on_overworld = false;
|
m_have_kart_last_position_on_overworld = false;
|
||||||
|
m_num_local_players = 0;
|
||||||
setMaxGoal(0);
|
setMaxGoal(0);
|
||||||
setTimeTarget(0.0f);
|
setTimeTarget(0.0f);
|
||||||
setReverseTrack(false);
|
setReverseTrack(false);
|
||||||
|
@ -1479,7 +1479,7 @@ void RaceResultGUI::backToLobby()
|
|||||||
("sshot_label_" + StringUtils::toString(n_sshot)).c_str());
|
("sshot_label_" + StringUtils::toString(n_sshot)).c_str());
|
||||||
assert(sshot != NULL && label != NULL);
|
assert(sshot != NULL && label != NULL);
|
||||||
|
|
||||||
// Network grand prix chooses each track 1 bye 1
|
// Network grand prix chooses each track 1 by 1
|
||||||
if (track == NULL)
|
if (track == NULL)
|
||||||
{
|
{
|
||||||
sshot->setImage(file_manager->getAsset(FileManager::GUI,
|
sshot->setImage(file_manager->getAsset(FileManager::GUI,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user