27 lines
812 B
C++
27 lines
812 B
C++
#include <client/state/GameState.h>
|
|
|
|
namespace td {
|
|
namespace client {
|
|
|
|
GameState::GameState(Client& a_Client, const std::shared_ptr<game::World>& a_World, std::uint64_t a_StepTime) :
|
|
ClientState(a_Client), m_World(a_World), m_Simulation(a_World, a_StepTime) {
|
|
m_Simulation.OnMissingLockSteps.Connect([this](const std::vector<td::StepTime>& a_MissingSteps) {
|
|
SendPacket(protocol::packets::LockStepRequestPacket(a_MissingSteps));
|
|
});
|
|
}
|
|
|
|
void GameState::Handle(const protocol::packets::LockStepsPacket& a_LockStep) {
|
|
m_Simulation.Handle(a_LockStep);
|
|
}
|
|
|
|
void GameState::Handle(const protocol::packets::LockStepResponsePacket& a_LockStep) {
|
|
m_Simulation.Handle(a_LockStep);
|
|
}
|
|
|
|
void GameState::Update(float a_Delta) {
|
|
m_CurrentLerp = m_Simulation.Update(a_Delta);
|
|
}
|
|
|
|
} // namespace client
|
|
} // namespace td
|