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-20 13:32:23 -04:00
|
|
|
#include "network/protocols/controller_events_protocol.hpp"
|
2013-07-13 19:16:40 -04:00
|
|
|
#include "modes/world.hpp"
|
|
|
|
|
2013-07-16 10:45:48 -04:00
|
|
|
#include "karts/controller/controller.hpp"
|
|
|
|
|
2013-07-13 19:16:40 -04:00
|
|
|
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:32:36 -04:00
|
|
|
Log::debug("NetworkWorld", "Coutdown value is %f", protocol->getCountdown());
|
2013-07-15 11:06:11 -04:00
|
|
|
if (protocol->getCountdown() > 0.0)
|
2013-07-15 09:44:17 -04:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2013-07-13 19:16:40 -04:00
|
|
|
World::getWorld()->updateWorld(dt);
|
|
|
|
}
|
2013-07-16 10:45:48 -04:00
|
|
|
|
|
|
|
void NetworkWorld::controllerAction(Controller* controller, PlayerAction action, int value)
|
|
|
|
{
|
2013-07-20 13:32:23 -04:00
|
|
|
ControllerEventsProtocol* protocol = static_cast<ControllerEventsProtocol*>(
|
|
|
|
ProtocolManager::getInstance()->getProtocol(PROTOCOL_CONTROLLER_EVENTS));
|
|
|
|
if (protocol)
|
|
|
|
protocol->controllerAction(controller, action, value);
|
2013-07-16 10:45:48 -04:00
|
|
|
}
|