Ça s'ra pas long. Non non non non non.

This commit is contained in:
MarcEricMartel 2023-12-18 11:18:42 -05:00
parent 9a669acd9c
commit cf831e339f
2 changed files with 11 additions and 1 deletions

View File

@ -1520,13 +1520,17 @@ void Engine::Render(float elapsedTime) {
char* prevptr = nullptr;
Chat chat;
for (auto& pck : lsPck) { // We could make a few threads out of this.
Sync sync; Output out; ChunkMod cmod; BulletAdd bull;
Sync sync; Output out; ChunkMod cmod; BulletAdd bull; PickupMod pmod;
if (!prevptr)
prevptr = m_buf.ptr;
uint32_t bsize = m_buf.len - (pck - prevptr);
prevptr = pck;
switch (getType(pck, 1)) {
using enum PACKET_TYPE;
case PICKUPMOD:
if (Deserialize(&pmod, pck, &bsize)) {
// TODO pikoppe
}
case SYNC:
if (Deserialize(&sync, pck, &bsize)) {
if (sync.sid != m_conn.getId()) {
@ -1547,6 +1551,11 @@ void Engine::Render(float elapsedTime) {
if (diff.y < 1.)
diff.y = 0;
Boosts boost = sync.boost;
m_player.boostdamage = boost.damage;
m_player.boostinvincible = boost.invincible;
if (diff.Length() > 1.5) {
diff.Normalize();
m_player.Move(-diff);

View File

@ -252,6 +252,7 @@ private:
std::set<uint64_t> m_deadplayers;
netprot::Buffer m_buf, m_bufout;
netprot::ChunkMod* m_chunkmod = nullptr;
std::map<uint64_t, Booster*> m_boosters;
std::unordered_map<uint64_t, netprot::Sync> m_syncs;
std::string m_messageNotification = "";