less serialize code
This commit is contained in:
@@ -33,7 +33,7 @@ void GameHistory::FromPacket(protocol::pdata::LockSteps&& a_Steps) {
|
||||
}
|
||||
|
||||
protocol::packets::LockStepsPacket GameHistory::ToPacket(HistorySizeType a_StartIndex) {
|
||||
Array<protocol::LockStep, LOCKSTEP_BUFFER_SIZE> steps;
|
||||
std::array<protocol::LockStep, LOCKSTEP_BUFFER_SIZE> steps;
|
||||
for (int i = 0; i < LOCKSTEP_BUFFER_SIZE; i++) {
|
||||
steps[i] = GetLockStep(a_StartIndex + i);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ std::uint64_t GetTime() {
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock().now().time_since_epoch()).count());
|
||||
}
|
||||
|
||||
RealTimeSimulation::RealTimeSimulation(game::World& a_World, const GameHistory& a_History, std::uint64_t a_StepTime) :
|
||||
RealTimeSimulation::RealTimeSimulation(game::World& a_World, GameHistory&& a_History, std::uint64_t a_StepTime) :
|
||||
m_StepTime(a_StepTime),
|
||||
m_World(a_World),
|
||||
m_CurrentTime(0),
|
||||
@@ -21,8 +21,8 @@ RealTimeSimulation::RealTimeSimulation(game::World& a_World, const GameHistory&
|
||||
m_LastSnapshot(std::make_shared<WorldSnapshot>()),
|
||||
m_LastValidStep(0) {
|
||||
m_History.reserve(a_History.size());
|
||||
for (const auto& lockstep : a_History) {
|
||||
m_History.emplace_back(lockstep);
|
||||
for (auto&& lockstep : a_History) {
|
||||
m_History.emplace_back(std::move(lockstep));
|
||||
}
|
||||
Step();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user