cleaning the logs now everything works. Now a player can connect to a server, select a kart (all in console), and the server can start a game. The game starts on clients when the server tells it.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@13256 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hilnius 2013-07-15 16:50:17 +00:00
parent d6618969f4
commit e139380a59
4 changed files with 12 additions and 11 deletions

View File

@ -26,9 +26,6 @@ void NetworkWorld::update(float dt)
}
else
{
// kill those two protocols
ProtocolManager::getInstance()->requestTerminate(protocol);
ProtocolManager::getInstance()->requestTerminate(ProtocolManager::getInstance()->getProtocol(PROTOCOL_START_GAME));
}
}
World::getWorld()->updateWorld(dt);

View File

@ -277,7 +277,7 @@ void ProtocolManager::propagateEvent(Event* event)
{
searchedProtocol = PROTOCOL_CONNECTION;
}
Log::info("ProtocolManager", "Received event for protocols of type %d", searchedProtocol);
Log::verbose("ProtocolManager", "Received event for protocols of type %d", searchedProtocol);
for (unsigned int i = 0; i < m_protocols.size() ; i++)
{
if (m_protocols[i].protocol->getProtocolType() == searchedProtocol || event->type == EVENT_TYPE_DISCONNECTED) // pass data to protocols even when paused

View File

@ -110,7 +110,7 @@ void StartGameProtocol::update()
int new_player_id = StateManager::get()->createActivePlayer( profileToUse, device );
// self config
}
Log::info("StartGameProtocol", "Players config ready.");
Log::info("StartGameProtocol", "Player configuration ready.");
m_state = SYNCHRONIZATION_WAIT;
/*
KartSelectionScreen* s = KartSelectionScreen::getInstance();
@ -146,8 +146,8 @@ void StartGameProtocol::ready() // on clients, means the loading is finished
assert(NetworkManager::getInstance()->getPeerCount() == 1);
NetworkString ns;
ns.ai32(NetworkManager::getInstance()->getPeers()[0]->getClientServerToken()).ai8(1);
Log::info("StartGameProtocol", "Player ready, notifying server.");
m_listener->sendMessage(this, ns, true);
Log::info("StartGameProtocol", "Player ready, sending message to server.");
m_state = READY;
}
else // on the server

View File

@ -92,7 +92,7 @@ void SynchronizationProtocol::notifyEvent(Event* event)
m_successed_pings[peer_id]++;
m_average_ping[peer_id] = (int)((m_total_diff[peer_id]/m_successed_pings[peer_id])*1000.0);
Log::info("SynchronizationProtocol", "Ping is %u", m_average_ping[peer_id]);
Log::debug("SynchronizationProtocol", "Ping is %u", m_average_ping[peer_id]);
}
}
@ -114,7 +114,13 @@ void SynchronizationProtocol::asynchronousUpdate()
{
m_countdown -= (current_time - m_last_countdown_update);
m_last_countdown_update = current_time;
Log::info("SynchronizationProtocol", "Update! Countdown remaining : %f", m_countdown);
Log::debug("SynchronizationProtocol", "Update! Countdown remaining : %f", m_countdown);
if (m_countdown < 0.0)
{
Log::info("SynchronizationProtocol", "Countdown finished. Starting now.");
m_listener->requestTerminate(this);
return;
}
}
if (current_time > timer+0.1)
{
@ -127,9 +133,7 @@ void SynchronizationProtocol::asynchronousUpdate()
if (m_countdown_activated && m_listener->isServer())
{
ns.addUInt32((int)(m_countdown*1000.0));
Log::info("SynchronizationProtocol", "CNTActivated: Countdown value : %f", m_countdown);
Log::info("SynchronizationProtocol", "Sent integer %d", (int)(m_countdown*1000.0));
Log::info("SynchronizationProtocol", "Sent integer %d", (int)(ns.getUInt32(10)));
Log::debug("SynchronizationProtocol", "CNTActivated: Countdown value : %f", m_countdown);
}
Log::verbose("SynchronizationProtocol", "Added sequence number %u for peer %d", m_pings[i].size(), i);
timer = current_time;