adding log
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@13247 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
3bb6122f8e
commit
83d64e6fc2
@ -34,7 +34,6 @@ void* protocolManagerUpdate(void* data)
|
|||||||
while(!manager->exit())
|
while(!manager->exit())
|
||||||
{
|
{
|
||||||
manager->update();
|
manager->update();
|
||||||
irr_driver->getDevice()->sleep(20);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "network/network_manager.hpp"
|
#include "network/network_manager.hpp"
|
||||||
#include "network/protocol_manager.hpp"
|
#include "network/protocol_manager.hpp"
|
||||||
#include "network/game_setup.hpp"
|
#include "network/game_setup.hpp"
|
||||||
|
#include "network/network_world.hpp"
|
||||||
#include "network/protocols/synchronization_protocol.hpp"
|
#include "network/protocols/synchronization_protocol.hpp"
|
||||||
#include "race/race_manager.hpp"
|
#include "race/race_manager.hpp"
|
||||||
#include "utils/log.hpp"
|
#include "utils/log.hpp"
|
||||||
@ -88,7 +89,7 @@ void StartGameProtocol::update()
|
|||||||
Log::info("StartGameProtocol", "SynchronizationProtocol started.");
|
Log::info("StartGameProtocol", "SynchronizationProtocol started.");
|
||||||
// race startup sequence
|
// race startup sequence
|
||||||
|
|
||||||
|
NetworkWorld::getInstance<NetworkWorld>()->start(); // builds it and starts
|
||||||
race_manager->setNumKarts(m_game_setup->getPlayerCount());
|
race_manager->setNumKarts(m_game_setup->getPlayerCount());
|
||||||
race_manager->setNumPlayers(m_game_setup->getPlayerCount());
|
race_manager->setNumPlayers(m_game_setup->getPlayerCount());
|
||||||
race_manager->setNumLocalPlayers(1);
|
race_manager->setNumLocalPlayers(1);
|
||||||
@ -145,6 +146,7 @@ void StartGameProtocol::ready() // on clients, means the loading is finished
|
|||||||
NetworkString ns;
|
NetworkString ns;
|
||||||
ns.ai32(NetworkManager::getInstance()->getPeers()[0]->getClientServerToken()).ai8(1);
|
ns.ai32(NetworkManager::getInstance()->getPeers()[0]->getClientServerToken()).ai8(1);
|
||||||
m_listener->sendMessage(this, ns, true);
|
m_listener->sendMessage(this, ns, true);
|
||||||
|
Log::info("StartGameProtocol", "Player ready, sending message to server.");
|
||||||
m_state = READY;
|
m_state = READY;
|
||||||
}
|
}
|
||||||
else // on the server
|
else // on the server
|
||||||
|
@ -109,11 +109,6 @@ void SynchronizationProtocol::asynchronousUpdate()
|
|||||||
double current_time = Time::getRealTime();
|
double current_time = Time::getRealTime();
|
||||||
if (current_time > timer+0.1)
|
if (current_time > timer+0.1)
|
||||||
{
|
{
|
||||||
if (m_countdown_activated)
|
|
||||||
{
|
|
||||||
m_countdown -= (int)((current_time - m_last_countdown_update)*1000.0);
|
|
||||||
m_last_countdown_update = current_time;
|
|
||||||
}
|
|
||||||
std::vector<STKPeer*> peers = NetworkManager::getInstance()->getPeers();
|
std::vector<STKPeer*> peers = NetworkManager::getInstance()->getPeers();
|
||||||
for (unsigned int i = 0; i < peers.size(); i++)
|
for (unsigned int i = 0; i < peers.size(); i++)
|
||||||
{
|
{
|
||||||
@ -131,8 +126,14 @@ void SynchronizationProtocol::asynchronousUpdate()
|
|||||||
m_listener->sendMessage(this, peers[i], ns, false);
|
m_listener->sendMessage(this, peers[i], ns, false);
|
||||||
m_pings_count[i]++;
|
m_pings_count[i]++;
|
||||||
}
|
}
|
||||||
Log::info("SynchronizationProtocol", "Countdown remaining : %d", m_countdown);
|
|
||||||
}
|
}
|
||||||
|
if (m_countdown_activated)
|
||||||
|
{
|
||||||
|
m_countdown -= (int)((current_time - m_last_countdown_update)*1000.0);
|
||||||
|
m_last_countdown_update = current_time;
|
||||||
|
}
|
||||||
|
Log::info("SynchronizationProtocol", "Update! Countdown remaining : %d", m_countdown);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -461,6 +461,11 @@ void RaceManager::startNextRace()
|
|||||||
m_kart_status[i].m_last_score = m_kart_status[i].m_score;
|
m_kart_status[i].m_last_score = m_kart_status[i].m_score;
|
||||||
m_kart_status[i].m_last_time = 0;
|
m_kart_status[i].m_last_time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StartGameProtocol* protocol = static_cast<StartGameProtocol*>(
|
||||||
|
ProtocolManager::getInstance()->getProtocol(PROTOCOL_SYNCHRONIZATION));
|
||||||
|
if (protocol)
|
||||||
|
protocol->ready();
|
||||||
} // startNextRace
|
} // startNextRace
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user