From 3283a23ee819f00762f6f5c4a418902ae5872ee3 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Wed, 22 Nov 2023 03:15:05 -0300 Subject: [PATCH] fix: prey reroll time on old protocol (#1876) Resolves #1837 --- src/server/network/protocol/protocolgame.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index dc6cea87b90..d60c653aced 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -6899,7 +6899,10 @@ void ProtocolGame::sendPreyData(const std::unique_ptr &slot) { } if (oldProtocol) { - msg.add(static_cast(std::max(std::max(static_cast(((slot->freeRerollTimeStamp - OTSYS_TIME()) / 1000)), 0), 0))); + auto currentTime = OTSYS_TIME(); + auto timeDiffMs = (slot->freeRerollTimeStamp > currentTime) ? (slot->freeRerollTimeStamp - currentTime) : 0; + auto timeDiffMinutes = timeDiffMs / 60000; + msg.add(timeDiffMinutes ? timeDiffMinutes : 0); } else { msg.add(std::max(static_cast(((slot->freeRerollTimeStamp - OTSYS_TIME()) / 1000)), 0)); msg.addByte(static_cast(slot->option));