diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index 741ee98..7ed6fde 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -1324,8 +1324,10 @@ void Engine::Render(float elapsedTime) { using enum PACKET_TYPE; case SYNC: if (Deserialize(&sync, pck, &bsize)) { - if (sync.sid != m_conn.getId()) + if (sync.sid != m_conn.getId()) { + std::cout << "syncid be no good."; break; + } if (m_syncs.contains(sync.timestamp)) { Sync comp = m_syncs[sync.timestamp]; m_player.InflictDamage(sync.hp - comp.hp); @@ -1333,20 +1335,23 @@ void Engine::Render(float elapsedTime) { Vector3f diff = sync.position - comp.position; if (diff.Length() > .5) m_player.Move(diff); - - // TODO: m_timer = sync.timer; + + // TODO: Syncer sync.timer avec le timer } + else std::cout << "sync be no good."; } break; case OUTPUT: if (Deserialize(&out, pck, &bsize)) { - RemotePlayer* r = m_players[out.id]; - if (!r) + if (!m_players.contains(out.id)) { + std::cout << "id be no good. "; break; - r->Feed(out); + } + m_players[out.id]->Feed(out); } break; default: + std::cout << "packet be no good."; break; } } diff --git a/SQCSim2021/engine.h b/SQCSim2021/engine.h index d7860ed..8c5ee10 100644 --- a/SQCSim2021/engine.h +++ b/SQCSim2021/engine.h @@ -102,7 +102,7 @@ private: Bullet* m_bullets[MAX_BULLETS]; - std::unordered_map m_players; + std::unordered_map m_players; netprot::Buffer m_buf, m_bufout; std::chrono::high_resolution_clock::time_point m_startTime;