2013-07-13 19:16:40 -04:00
|
|
|
#include "network/network_world.hpp"
|
|
|
|
|
2013-07-15 09:44:17 -04:00
|
|
|
#include "network/protocol_manager.hpp"
|
|
|
|
#include "network/protocols/synchronization_protocol.hpp"
|
2013-07-13 19:16:40 -04:00
|
|
|
#include "modes/world.hpp"
|
|
|
|
|
|
|
|
NetworkWorld::NetworkWorld()
|
|
|
|
{
|
|
|
|
m_running = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
NetworkWorld::~NetworkWorld()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void NetworkWorld::update(float dt)
|
|
|
|
{
|
2013-07-15 09:44:17 -04:00
|
|
|
SynchronizationProtocol* protocol = static_cast<SynchronizationProtocol*>(
|
|
|
|
ProtocolManager::getInstance()->getProtocol(PROTOCOL_SYNCHRONIZATION));
|
|
|
|
if (protocol) // if this protocol exists, that's that we play online
|
|
|
|
{
|
2013-07-15 11:06:11 -04:00
|
|
|
Log::info("NetworkWorld", "Coutdown value is %lf", protocol->getCountdown());
|
|
|
|
if (protocol->getCountdown() > 0.0)
|
2013-07-15 09:44:17 -04:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2013-07-15 09:50:39 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// kill those two protocols
|
|
|
|
ProtocolManager::getInstance()->requestStop(protocol);
|
|
|
|
ProtocolManager::getInstance()->requestStop(ProtocolManager::getInstance()->getProtocol(PROTOCOL_START_GAME));
|
|
|
|
}
|
2013-07-15 09:44:17 -04:00
|
|
|
}
|
2013-07-13 19:16:40 -04:00
|
|
|
World::getWorld()->updateWorld(dt);
|
|
|
|
}
|