serversimulation
This commit is contained in:
@@ -1,21 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
#include <td/game/World.h>
|
||||
|
||||
namespace td {
|
||||
namespace sim {
|
||||
|
||||
// TODO: OnEnd signal
|
||||
class ServerSimulation {
|
||||
/**
|
||||
* \note This class is thread safe
|
||||
*/
|
||||
class ServerSimulation : public protocol::CommandHandler {
|
||||
private:
|
||||
std::mutex m_Mutex;
|
||||
game::World& m_World;
|
||||
std::uint64_t m_StepTime;
|
||||
std::uint64_t m_CurrentTime;
|
||||
std::vector<td::protocol::LockStep> m_History;
|
||||
|
||||
using protocol::CommandHandler::Handle;
|
||||
|
||||
public:
|
||||
ServerSimulation(game::World& a_World, std::uint64_t a_StepTime);
|
||||
|
||||
void Update();
|
||||
protocol::packets::LockStepsPacket Update();
|
||||
|
||||
// no checks are done !
|
||||
|
||||
virtual void Handle(const protocol::commands::SpawnTroopCommand& a_SpawnTroop) override;
|
||||
virtual void Handle(const protocol::commands::PlaceTowerCommand& a_PlaceTower) override;
|
||||
};
|
||||
|
||||
} // namespace sim
|
||||
|
||||
Reference in New Issue
Block a user