Added time step size as parameter to each protocol's synchromous update
function (which is needed for interpolation later).
This commit is contained in:
parent
10bb5caae3
commit
d25f3cee25
@ -184,7 +184,7 @@ void MainLoop::run()
|
|||||||
if (STKHost::get()->requestedShutdown())
|
if (STKHost::get()->requestedShutdown())
|
||||||
STKHost::get()->shutdown();
|
STKHost::get()->shutdown();
|
||||||
else
|
else
|
||||||
ProtocolManager::getInstance()->update();
|
ProtocolManager::getInstance()->update(dt);
|
||||||
}
|
}
|
||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_POP_CPU_MARKER();
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ void MainLoop::run()
|
|||||||
{
|
{
|
||||||
PROFILER_PUSH_CPU_MARKER("Protocol manager update", 0x7F, 0x00, 0x7F);
|
PROFILER_PUSH_CPU_MARKER("Protocol manager update", 0x7F, 0x00, 0x7F);
|
||||||
if(NetworkConfig::get()->isNetworking())
|
if(NetworkConfig::get()->isNetworking())
|
||||||
ProtocolManager::getInstance()->update();
|
ProtocolManager::getInstance()->update(dt);
|
||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_POP_CPU_MARKER();
|
||||||
|
|
||||||
PROFILER_PUSH_CPU_MARKER("Database polling update", 0x00, 0x7F, 0x7F);
|
PROFILER_PUSH_CPU_MARKER("Database polling update", 0x00, 0x7F, 0x7F);
|
||||||
|
@ -121,7 +121,7 @@ public:
|
|||||||
|
|
||||||
/** \brief Called by the protocol listener, synchronously with the main
|
/** \brief Called by the protocol listener, synchronously with the main
|
||||||
* loop. Must be re-defined.*/
|
* loop. Must be re-defined.*/
|
||||||
virtual void update() = 0;
|
virtual void update(float dt) = 0;
|
||||||
|
|
||||||
/** \brief Called by the protocol listener as often as possible.
|
/** \brief Called by the protocol listener as often as possible.
|
||||||
* Must be re-defined. */
|
* Must be re-defined. */
|
||||||
|
@ -321,7 +321,7 @@ bool ProtocolManager::sendEvent(Event* event)
|
|||||||
* This function is called by the main thread (i.e. from main_loop).
|
* This function is called by the main thread (i.e. from main_loop).
|
||||||
* This function IS FPS-dependant.
|
* This function IS FPS-dependant.
|
||||||
*/
|
*/
|
||||||
void ProtocolManager::update()
|
void ProtocolManager::update(float dt)
|
||||||
{
|
{
|
||||||
// before updating, notify protocols that they have received events
|
// before updating, notify protocols that they have received events
|
||||||
m_events_to_process.lock();
|
m_events_to_process.lock();
|
||||||
@ -346,7 +346,7 @@ void ProtocolManager::update()
|
|||||||
for (unsigned int i = 0; i < m_protocols.getData().size(); i++)
|
for (unsigned int i = 0; i < m_protocols.getData().size(); i++)
|
||||||
{
|
{
|
||||||
if (m_protocols.getData()[i]->getState() == PROTOCOL_STATE_RUNNING)
|
if (m_protocols.getData()[i]->getState() == PROTOCOL_STATE_RUNNING)
|
||||||
m_protocols.getData()[i]->update();
|
m_protocols.getData()[i]->update(dt);
|
||||||
}
|
}
|
||||||
m_protocols.unlock();
|
m_protocols.unlock();
|
||||||
} // update
|
} // update
|
||||||
|
@ -144,7 +144,7 @@ public:
|
|||||||
virtual void requestPause(Protocol* protocol);
|
virtual void requestPause(Protocol* protocol);
|
||||||
virtual void requestUnpause(Protocol* protocol);
|
virtual void requestUnpause(Protocol* protocol);
|
||||||
virtual void requestTerminate(Protocol* protocol);
|
virtual void requestTerminate(Protocol* protocol);
|
||||||
virtual void update();
|
virtual void update(float dt);
|
||||||
virtual Protocol* getProtocol(uint32_t id);
|
virtual Protocol* getProtocol(uint32_t id);
|
||||||
virtual Protocol* getProtocol(ProtocolType type);
|
virtual Protocol* getProtocol(ProtocolType type);
|
||||||
}; // class ProtocolManager
|
}; // class ProtocolManager
|
||||||
|
@ -269,7 +269,7 @@ bool ClientLobbyRoomProtocol::notifyEventAsynchronous(Event* event)
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ClientLobbyRoomProtocol::update()
|
void ClientLobbyRoomProtocol::update(float dt)
|
||||||
{
|
{
|
||||||
switch (m_state)
|
switch (m_state)
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "network/protocols/lobby_room_protocol.hpp"
|
#include "network/protocols/lobby_room_protocol.hpp"
|
||||||
#include "network/transport_address.hpp"
|
#include "network/transport_address.hpp"
|
||||||
|
#include "utils/cpp2011.hpp"
|
||||||
|
|
||||||
class STKPeer;
|
class STKPeer;
|
||||||
|
|
||||||
@ -64,11 +65,11 @@ public:
|
|||||||
void doneWithResults();
|
void doneWithResults();
|
||||||
void leave();
|
void leave();
|
||||||
|
|
||||||
virtual bool notifyEvent(Event* event);
|
virtual bool notifyEvent(Event* event) OVERRIDE;
|
||||||
virtual bool notifyEventAsynchronous(Event* event);
|
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE;
|
||||||
virtual void setup();
|
virtual void setup() OVERRIDE;
|
||||||
virtual void update();
|
virtual void update(float dt) OVERRIDE;
|
||||||
virtual void asynchronousUpdate() {}
|
virtual void asynchronousUpdate() OVERRIDE {}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE;
|
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE;
|
||||||
virtual void setup() OVERRIDE;
|
virtual void setup() OVERRIDE;
|
||||||
virtual void update() OVERRIDE {}
|
virtual void update(float dt) OVERRIDE {}
|
||||||
virtual void asynchronousUpdate() OVERRIDE;
|
virtual void asynchronousUpdate() OVERRIDE;
|
||||||
virtual void callback(Protocol *protocol) OVERRIDE;
|
virtual void callback(Protocol *protocol) OVERRIDE;
|
||||||
}; // class ConnectToPeer
|
}; // class ConnectToPeer
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
virtual void setup() OVERRIDE;
|
virtual void setup() OVERRIDE;
|
||||||
virtual void asynchronousUpdate() OVERRIDE;
|
virtual void asynchronousUpdate() OVERRIDE;
|
||||||
virtual void callback(Protocol *protocol) OVERRIDE;
|
virtual void callback(Protocol *protocol) OVERRIDE;
|
||||||
virtual void update() OVERRIDE {}
|
virtual void update(float dt) OVERRIDE {}
|
||||||
void setServerAddress(const TransportAddress &address);
|
void setServerAddress(const TransportAddress &address);
|
||||||
}; // class ConnectToServer
|
}; // class ConnectToServer
|
||||||
|
|
||||||
|
@ -95,12 +95,6 @@ bool ControllerEventsProtocol::notifyEventAsynchronous(Event* event)
|
|||||||
return true;
|
return true;
|
||||||
} // notifyEventAsynchronous
|
} // notifyEventAsynchronous
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void ControllerEventsProtocol::update()
|
|
||||||
{
|
|
||||||
} // update
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Called from the local kart controller when an action (like steering,
|
/** Called from the local kart controller when an action (like steering,
|
||||||
* acceleration, ...) was triggered. It compresses the current kart control
|
* acceleration, ...) was triggered. It compresses the current kart control
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "network/protocol.hpp"
|
#include "network/protocol.hpp"
|
||||||
|
|
||||||
#include "input/input.hpp"
|
#include "input/input.hpp"
|
||||||
|
#include "utils/cpp2011.hpp"
|
||||||
|
|
||||||
class Controller;
|
class Controller;
|
||||||
class STKPeer;
|
class STKPeer;
|
||||||
@ -33,10 +34,10 @@ public:
|
|||||||
ControllerEventsProtocol();
|
ControllerEventsProtocol();
|
||||||
virtual ~ControllerEventsProtocol();
|
virtual ~ControllerEventsProtocol();
|
||||||
|
|
||||||
virtual bool notifyEventAsynchronous(Event* event);
|
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE;
|
||||||
virtual void update();
|
virtual void update(float dt) OVERRIDE {};
|
||||||
virtual void setup() {};
|
virtual void setup() OVERRIDE {};
|
||||||
virtual void asynchronousUpdate() {}
|
virtual void asynchronousUpdate() OVERRIDE {}
|
||||||
|
|
||||||
void controllerAction(Controller* controller, PlayerAction action,
|
void controllerAction(Controller* controller, PlayerAction action,
|
||||||
int value);
|
int value);
|
||||||
|
@ -63,16 +63,6 @@ bool GameEventsProtocol::notifyEvent(Event* event)
|
|||||||
return true;
|
return true;
|
||||||
} // notifyEvent
|
} // notifyEvent
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
void GameEventsProtocol::setup()
|
|
||||||
{
|
|
||||||
} // setup
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
void GameEventsProtocol::update()
|
|
||||||
{
|
|
||||||
} // update
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** Called on the server when an item is collected.
|
/** Called on the server when an item is collected.
|
||||||
*/
|
*/
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define GAME_EVENTS_PROTOCOL_HPP
|
#define GAME_EVENTS_PROTOCOL_HPP
|
||||||
|
|
||||||
#include "network/protocol.hpp"
|
#include "network/protocol.hpp"
|
||||||
|
#include "utils/cpp2011.hpp"
|
||||||
|
|
||||||
class AbstractKart;
|
class AbstractKart;
|
||||||
class Item;
|
class Item;
|
||||||
@ -18,17 +19,19 @@ public:
|
|||||||
GameEventsProtocol();
|
GameEventsProtocol();
|
||||||
virtual ~GameEventsProtocol();
|
virtual ~GameEventsProtocol();
|
||||||
|
|
||||||
virtual bool notifyEvent(Event* event);
|
virtual bool notifyEvent(Event* event) OVERRIDE;
|
||||||
virtual void setup();
|
|
||||||
virtual void update();
|
|
||||||
void collectedItem(Item* item, AbstractKart* kart);
|
void collectedItem(Item* item, AbstractKart* kart);
|
||||||
void collectedItem(const NetworkString &ns);
|
void collectedItem(const NetworkString &ns);
|
||||||
void kartFinishedRace(AbstractKart *kart, float time);
|
void kartFinishedRace(AbstractKart *kart, float time);
|
||||||
void kartFinishedRace(const NetworkString &ns);
|
void kartFinishedRace(const NetworkString &ns);
|
||||||
|
virtual void setup() OVERRIDE {};
|
||||||
|
virtual void update(float dt) OVERRIDE {};
|
||||||
|
virtual void asynchronousUpdate() OVERRIDE{}
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
virtual void asynchronousUpdate() {}
|
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE
|
||||||
// ------------------------------------------------------------------------
|
{
|
||||||
virtual bool notifyEventAsynchronous(Event* event) { return false; }
|
return false;
|
||||||
|
} // notifyEventAsynchronous
|
||||||
|
|
||||||
|
|
||||||
}; // class GameEventsProtocol
|
}; // class GameEventsProtocol
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "network/protocol.hpp"
|
#include "network/protocol.hpp"
|
||||||
#include "network/transport_address.hpp"
|
#include "network/transport_address.hpp"
|
||||||
|
#include "utils/cpp2011.hpp"
|
||||||
|
|
||||||
namespace Online { class XMLRequest; }
|
namespace Online { class XMLRequest; }
|
||||||
|
|
||||||
@ -37,19 +38,19 @@ public:
|
|||||||
GetPeerAddress(uint32_t peer_id, CallbackObject* callback_object);
|
GetPeerAddress(uint32_t peer_id, CallbackObject* callback_object);
|
||||||
virtual ~GetPeerAddress();
|
virtual ~GetPeerAddress();
|
||||||
|
|
||||||
virtual void setup();
|
virtual void setup() OVERRIDE;
|
||||||
virtual void asynchronousUpdate();
|
virtual void asynchronousUpdate() OVERRIDE;
|
||||||
void setPeerID(uint32_t m_peer_id);
|
void setPeerID(uint32_t m_peer_id);
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the address found. */
|
/** Returns the address found. */
|
||||||
const TransportAddress &getAddress() const { return m_address; }
|
const TransportAddress &getAddress() const { return m_address; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
virtual void update() {}
|
virtual void update(float dt) OVERRIDE {}
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
virtual bool notifyEvent(Event* event) { return true; }
|
virtual bool notifyEvent(Event* event) OVERRIDE { return true; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
virtual bool notifyEventAsynchronous(Event* event) { return true; }
|
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE { return true; }
|
||||||
|
|
||||||
}; // class GetPeerAddress
|
}; // class GetPeerAddress
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#define GET_PUBLIC_ADDRESS_HPP
|
#define GET_PUBLIC_ADDRESS_HPP
|
||||||
|
|
||||||
#include "network/protocol.hpp"
|
#include "network/protocol.hpp"
|
||||||
|
#include "utils/cpp2011.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -27,16 +28,6 @@ class Network;
|
|||||||
|
|
||||||
class GetPublicAddress : public Protocol
|
class GetPublicAddress : public Protocol
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
GetPublicAddress(CallbackObject *callback = NULL);
|
|
||||||
virtual ~GetPublicAddress() {}
|
|
||||||
|
|
||||||
virtual bool notifyEvent(Event* event) { return true; }
|
|
||||||
virtual bool notifyEventAsynchronous(Event* event) { return true; }
|
|
||||||
virtual void setup() { m_state = NOTHING_DONE; }
|
|
||||||
virtual void update() {}
|
|
||||||
virtual void asynchronousUpdate();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createStunRequest();
|
void createStunRequest();
|
||||||
std::string parseStunResponse();
|
std::string parseStunResponse();
|
||||||
@ -55,6 +46,21 @@ class GetPublicAddress : public Protocol
|
|||||||
uint8_t m_stun_tansaction_id[12];
|
uint8_t m_stun_tansaction_id[12];
|
||||||
uint32_t m_stun_server_ip;
|
uint32_t m_stun_server_ip;
|
||||||
Network* m_transaction_host;
|
Network* m_transaction_host;
|
||||||
};
|
|
||||||
|
public:
|
||||||
|
GetPublicAddress(CallbackObject *callback = NULL);
|
||||||
|
virtual ~GetPublicAddress() {}
|
||||||
|
|
||||||
|
virtual void asynchronousUpdate() OVERRIDE;
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual void update(float dt) OVERRIDE {}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual bool notifyEvent(Event* event) OVERRIDE { return true; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE { return true; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual void setup() { m_state = NOTHING_DONE; }
|
||||||
|
|
||||||
|
}; // class GetPublicAddress
|
||||||
|
|
||||||
#endif // GET_PUBLIC_ADDRESS_HPP
|
#endif // GET_PUBLIC_ADDRESS_HPP
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#define HIDE_PUBLIC_ADDRESS_HPP
|
#define HIDE_PUBLIC_ADDRESS_HPP
|
||||||
|
|
||||||
#include "network/protocol.hpp"
|
#include "network/protocol.hpp"
|
||||||
|
#include "utils/cpp2011.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -27,17 +28,7 @@ namespace Online { class XMLRequest; }
|
|||||||
|
|
||||||
class HidePublicAddress : public Protocol
|
class HidePublicAddress : public Protocol
|
||||||
{
|
{
|
||||||
public:
|
private:
|
||||||
HidePublicAddress();
|
|
||||||
virtual ~HidePublicAddress();
|
|
||||||
|
|
||||||
virtual bool notifyEvent(Event* event) { return true; }
|
|
||||||
virtual bool notifyEventAsynchronous(Event* event) { return true; }
|
|
||||||
virtual void setup();
|
|
||||||
virtual void update() {}
|
|
||||||
virtual void asynchronousUpdate();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Online::XMLRequest* m_request;
|
Online::XMLRequest* m_request;
|
||||||
enum STATE
|
enum STATE
|
||||||
{
|
{
|
||||||
@ -47,6 +38,19 @@ class HidePublicAddress : public Protocol
|
|||||||
EXITING
|
EXITING
|
||||||
};
|
};
|
||||||
STATE m_state;
|
STATE m_state;
|
||||||
};
|
|
||||||
|
public:
|
||||||
|
HidePublicAddress();
|
||||||
|
virtual ~HidePublicAddress();
|
||||||
|
|
||||||
|
virtual void asynchronousUpdate() OVERRIDE;
|
||||||
|
virtual void setup() OVERRIDE;
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual bool notifyEvent(Event* event) OVERRIDE { return true; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE { return true; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual void update(float dt) OVERRIDE {}
|
||||||
|
}; // class HidePublicAddress
|
||||||
|
|
||||||
#endif // HIDE_PUBLIC_ADDRESS_HPP
|
#endif // HIDE_PUBLIC_ADDRESS_HPP
|
||||||
|
@ -67,7 +67,7 @@ bool KartUpdateProtocol::notifyEvent(Event* event)
|
|||||||
* or more updates before this client handles them, only the last one will
|
* or more updates before this client handles them, only the last one will
|
||||||
* actually be handled (i.e. outdated kart position updates are discarded).
|
* actually be handled (i.e. outdated kart position updates are discarded).
|
||||||
*/
|
*/
|
||||||
void KartUpdateProtocol::update()
|
void KartUpdateProtocol::update(float dt)
|
||||||
{
|
{
|
||||||
if (!World::getWorld())
|
if (!World::getWorld())
|
||||||
return;
|
return;
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
#define KART_UPDATE_PROTOCOL_HPP
|
#define KART_UPDATE_PROTOCOL_HPP
|
||||||
|
|
||||||
#include "network/protocol.hpp"
|
#include "network/protocol.hpp"
|
||||||
|
#include "utils/cpp2011.hpp"
|
||||||
#include "utils/vec3.hpp"
|
#include "utils/vec3.hpp"
|
||||||
|
|
||||||
#include "LinearMath/btQuaternion.h"
|
#include "LinearMath/btQuaternion.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -27,10 +29,10 @@ public:
|
|||||||
KartUpdateProtocol();
|
KartUpdateProtocol();
|
||||||
virtual ~KartUpdateProtocol();
|
virtual ~KartUpdateProtocol();
|
||||||
|
|
||||||
virtual bool notifyEvent(Event* event);
|
virtual bool notifyEvent(Event* event) OVERRIDE;
|
||||||
virtual void setup();
|
virtual void setup() OVERRIDE;
|
||||||
virtual void update();
|
virtual void update(float dt) OVERRIDE;
|
||||||
virtual void asynchronousUpdate() {};
|
virtual void asynchronousUpdate() OVERRIDE {};
|
||||||
|
|
||||||
}; // KartUpdateProtocol
|
}; // KartUpdateProtocol
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public:
|
|||||||
virtual ~LobbyRoomProtocol() {}
|
virtual ~LobbyRoomProtocol() {}
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
virtual void setup() = 0;
|
virtual void setup() = 0;
|
||||||
virtual void update() = 0;
|
virtual void update(float dt) = 0;
|
||||||
}; // class LobbyRoomProtocol
|
}; // class LobbyRoomProtocol
|
||||||
|
|
||||||
#endif // LOBBY_ROOM_PROTOCOL_HPP
|
#endif // LOBBY_ROOM_PROTOCOL_HPP
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "network/protocol.hpp"
|
#include "network/protocol.hpp"
|
||||||
#include "network/transport_address.hpp"
|
#include "network/transport_address.hpp"
|
||||||
|
#include "utils/cpp2011.hpp"
|
||||||
|
|
||||||
class PingProtocol : public Protocol
|
class PingProtocol : public Protocol
|
||||||
{
|
{
|
||||||
@ -20,12 +21,15 @@ public:
|
|||||||
double delay_between_pings);
|
double delay_between_pings);
|
||||||
virtual ~PingProtocol();
|
virtual ~PingProtocol();
|
||||||
|
|
||||||
virtual bool notifyEvent(Event* event) { return true; }
|
virtual void asynchronousUpdate() OVERRIDE;
|
||||||
virtual bool notifyEventAsynchronous(Event* event) { return true; }
|
|
||||||
virtual void setup();
|
|
||||||
virtual void update() {}
|
|
||||||
virtual void asynchronousUpdate();
|
|
||||||
|
|
||||||
|
virtual void setup() OVERRIDE;
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual bool notifyEvent(Event* event) OVERRIDE { return true; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE { return true; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual void update(float dt) OVERRIDE {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PING_PROTOCOL_HPP
|
#endif // PING_PROTOCOL_HPP
|
||||||
|
@ -38,12 +38,14 @@ public:
|
|||||||
|
|
||||||
RequestConnection(uint32_t server_id);
|
RequestConnection(uint32_t server_id);
|
||||||
virtual ~RequestConnection();
|
virtual ~RequestConnection();
|
||||||
|
virtual void setup() OVERRIDE;
|
||||||
virtual bool notifyEvent(Event* event) { return true; }
|
virtual void asynchronousUpdate() OVERRIDE;
|
||||||
virtual bool notifyEventAsynchronous(Event* event) { return true; }
|
// ------------------------------------------------------------------------
|
||||||
virtual void setup();
|
virtual bool notifyEvent(Event* event) OVERRIDE { return true; }
|
||||||
virtual void update() {}
|
// ------------------------------------------------------------------------
|
||||||
virtual void asynchronousUpdate();
|
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE { return true; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual void update(float dt) OVERRIDE {}
|
||||||
|
|
||||||
|
|
||||||
}; // RequestConnection
|
}; // RequestConnection
|
||||||
|
@ -112,7 +112,7 @@ bool ServerLobbyRoomProtocol::notifyEventAsynchronous(Event* event)
|
|||||||
* is known, register the server and its address with the stk server so that
|
* is known, register the server and its address with the stk server so that
|
||||||
* client can find it.
|
* client can find it.
|
||||||
*/
|
*/
|
||||||
void ServerLobbyRoomProtocol::update()
|
void ServerLobbyRoomProtocol::update(float dt)
|
||||||
{
|
{
|
||||||
switch (m_state)
|
switch (m_state)
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
|
|
||||||
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE;
|
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE;
|
||||||
virtual void setup() OVERRIDE;
|
virtual void setup() OVERRIDE;
|
||||||
virtual void update() OVERRIDE;
|
virtual void update(float dt) OVERRIDE;
|
||||||
virtual void asynchronousUpdate() OVERRIDE {};
|
virtual void asynchronousUpdate() OVERRIDE {};
|
||||||
|
|
||||||
void startGame();
|
void startGame();
|
||||||
|
@ -170,7 +170,7 @@ void StartGameProtocol::startRace()
|
|||||||
} // startRace
|
} // startRace
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void StartGameProtocol::update()
|
void StartGameProtocol::update(float dt)
|
||||||
{
|
{
|
||||||
switch(m_state)
|
switch(m_state)
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#define START_GAME_PROTOCOL_HPP
|
#define START_GAME_PROTOCOL_HPP
|
||||||
|
|
||||||
#include "network/protocol.hpp"
|
#include "network/protocol.hpp"
|
||||||
|
#include "utils/cpp2011.hpp"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class GameSetup;
|
class GameSetup;
|
||||||
@ -39,10 +41,10 @@ public:
|
|||||||
virtual ~StartGameProtocol();
|
virtual ~StartGameProtocol();
|
||||||
|
|
||||||
virtual bool notifyEventAsynchronous(Event* event);
|
virtual bool notifyEventAsynchronous(Event* event);
|
||||||
virtual void setup();
|
virtual void setup() OVERRIDE;
|
||||||
virtual void update();
|
virtual void update(float dt) OVERRIDE;
|
||||||
void ready();
|
void ready();
|
||||||
virtual void asynchronousUpdate() {}
|
virtual void asynchronousUpdate() OVERRIDE {}
|
||||||
|
|
||||||
}; // class StartGameProtocol
|
}; // class StartGameProtocol
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define STOP_SERVER_HPP
|
#define STOP_SERVER_HPP
|
||||||
|
|
||||||
#include "network/protocol.hpp"
|
#include "network/protocol.hpp"
|
||||||
|
#include "utils/cpp2011.hpp"
|
||||||
|
|
||||||
namespace Online { class XMLRequest; }
|
namespace Online { class XMLRequest; }
|
||||||
|
|
||||||
@ -10,16 +11,7 @@ namespace Online { class XMLRequest; }
|
|||||||
|
|
||||||
class StopServer : public Protocol
|
class StopServer : public Protocol
|
||||||
{
|
{
|
||||||
public:
|
private:
|
||||||
StopServer();
|
|
||||||
virtual ~StopServer();
|
|
||||||
|
|
||||||
virtual bool notifyEventAsynchronous(Event* event);
|
|
||||||
virtual void setup();
|
|
||||||
virtual void update() {}
|
|
||||||
virtual void asynchronousUpdate();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Online::XMLRequest* m_request;
|
Online::XMLRequest* m_request;
|
||||||
enum STATE
|
enum STATE
|
||||||
{
|
{
|
||||||
@ -29,6 +21,16 @@ class StopServer : public Protocol
|
|||||||
EXITING
|
EXITING
|
||||||
};
|
};
|
||||||
STATE m_state;
|
STATE m_state;
|
||||||
|
public:
|
||||||
|
StopServer();
|
||||||
|
virtual ~StopServer();
|
||||||
|
|
||||||
|
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE;
|
||||||
|
virtual void setup() OVERRIDE;
|
||||||
|
virtual void asynchronousUpdate() OVERRIDE;
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
virtual void update(float dt) OVERRIDE {}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STOP_SERVER_HPP
|
#endif // STOP_SERVER_HPP
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#define SYNCHRONIZATION_PROTOCOL_HPP
|
#define SYNCHRONIZATION_PROTOCOL_HPP
|
||||||
|
|
||||||
#include "network/protocol.hpp"
|
#include "network/protocol.hpp"
|
||||||
|
#include "utils/cpp2011.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@ -28,12 +30,13 @@ public:
|
|||||||
SynchronizationProtocol();
|
SynchronizationProtocol();
|
||||||
virtual ~SynchronizationProtocol();
|
virtual ~SynchronizationProtocol();
|
||||||
|
|
||||||
virtual bool notifyEventAsynchronous(Event* event);
|
virtual bool notifyEventAsynchronous(Event* event) OVERRIDE;
|
||||||
virtual void setup();
|
virtual void setup() OVERRIDE;
|
||||||
virtual void update() {}
|
virtual void asynchronousUpdate() OVERRIDE;
|
||||||
virtual void asynchronousUpdate();
|
|
||||||
void startCountdown(int ms_countdown);
|
void startCountdown(int ms_countdown);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual void update(float dt) OVERRIDE {}
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
int getCountdown() { return (int)(m_countdown*1000.0); }
|
int getCountdown() { return (int)(m_countdown*1000.0); }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user