was a problem with starting protocol in setup
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@13231 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
4bde8a9337
commit
853d244882
@ -63,32 +63,36 @@ void StartGameProtocol::notifyEvent(Event* event)
|
||||
|
||||
void StartGameProtocol::setup()
|
||||
{
|
||||
m_state = LOADING;
|
||||
// if no synchronization protocol exists, create one
|
||||
SynchronizationProtocol* protocol = static_cast<SynchronizationProtocol*>(m_listener->getProtocol(PROTOCOL_SYNCHRONIZATION));
|
||||
if (!protocol)
|
||||
m_listener->requestStart(new SynchronizationProtocol());
|
||||
|
||||
race_manager->setNumKarts(m_game_setup->getPlayerCount());
|
||||
race_manager->setNumPlayers(m_game_setup->getPlayerCount());
|
||||
race_manager->setNumLocalPlayers(1);
|
||||
std::vector<NetworkPlayerProfile*> players = m_game_setup->getPlayers();
|
||||
for (unsigned int i = 0; i < players.size(); i++)
|
||||
{
|
||||
NetworkPlayerProfile* profile = players[i];
|
||||
RemoteKartInfo rki(profile->race_id, profile->kart_name, profile->user_profile->getUserName(), profile->race_id);
|
||||
rki.setGlobalPlayerId(profile->race_id);
|
||||
rki.setLocalPlayerId(profile->race_id);
|
||||
rki.setHostId(profile->race_id);
|
||||
race_manager->setPlayerKart(i, rki);
|
||||
}
|
||||
|
||||
race_manager->startSingleRace("jungle", 1, false);
|
||||
m_state = NONE;
|
||||
}
|
||||
|
||||
void StartGameProtocol::update()
|
||||
{
|
||||
if (m_state == LOADING)
|
||||
if (m_state == NONE)
|
||||
{
|
||||
// if no synchronization protocol exists, create one
|
||||
SynchronizationProtocol* protocol = static_cast<SynchronizationProtocol*>(m_listener->getProtocol(PROTOCOL_SYNCHRONIZATION));
|
||||
if (!protocol)
|
||||
m_listener->requestStart(new SynchronizationProtocol());
|
||||
|
||||
race_manager->setNumKarts(m_game_setup->getPlayerCount());
|
||||
race_manager->setNumPlayers(m_game_setup->getPlayerCount());
|
||||
race_manager->setNumLocalPlayers(1);
|
||||
std::vector<NetworkPlayerProfile*> players = m_game_setup->getPlayers();
|
||||
for (unsigned int i = 0; i < players.size(); i++)
|
||||
{
|
||||
NetworkPlayerProfile* profile = players[i];
|
||||
RemoteKartInfo rki(profile->race_id, profile->kart_name, profile->user_profile->getUserName(), profile->race_id);
|
||||
rki.setGlobalPlayerId(profile->race_id);
|
||||
rki.setLocalPlayerId(profile->race_id);
|
||||
rki.setHostId(profile->race_id);
|
||||
race_manager->setPlayerKart(i, rki);
|
||||
}
|
||||
|
||||
race_manager->startSingleRace("jungle", 1, false);
|
||||
m_state = LOADING;
|
||||
}
|
||||
else if (m_state == LOADING)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ class NetworkPlayerProfile;
|
||||
class StartGameProtocol : public Protocol
|
||||
{
|
||||
protected:
|
||||
enum STATE { LOADING, READY };
|
||||
enum STATE { NONE, LOADING, READY };
|
||||
std::map<NetworkPlayerProfile*, STATE> m_player_states;
|
||||
|
||||
GameSetup* m_game_setup;
|
||||
|
Loading…
x
Reference in New Issue
Block a user