stk-code_catmod/src/network/network_world.cpp
hilnius dec7a74c99 fix a bug in asynchronous protocols update management
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@13252 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-07-15 15:58:08 +00:00

36 lines
1.0 KiB
C++

#include "network/network_world.hpp"
#include "network/protocol_manager.hpp"
#include "network/protocols/synchronization_protocol.hpp"
#include "modes/world.hpp"
NetworkWorld::NetworkWorld()
{
m_running = false;
}
NetworkWorld::~NetworkWorld()
{
}
void NetworkWorld::update(float dt)
{
SynchronizationProtocol* protocol = static_cast<SynchronizationProtocol*>(
ProtocolManager::getInstance()->getProtocol(PROTOCOL_SYNCHRONIZATION));
if (protocol) // if this protocol exists, that's that we play online
{
Log::debug("NetworkWorld", "Coutdown value is %f", protocol->getCountdown());
if (protocol->getCountdown() > 0.0)
{
return;
}
else
{
// kill those two protocols
ProtocolManager::getInstance()->requestTerminate(protocol);
ProtocolManager::getInstance()->requestTerminate(ProtocolManager::getInstance()->getProtocol(PROTOCOL_START_GAME));
}
}
World::getWorld()->updateWorld(dt);
}