Skip to content

Commit

Permalink
fix: prey reroll time on old protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Nov 22, 2023
1 parent 5d5338e commit 364d06a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6899,7 +6899,10 @@ void ProtocolGame::sendPreyData(const std::unique_ptr<PreySlot> &slot) {
}

if (oldProtocol) {
msg.add<uint16_t>(static_cast<uint16_t>(std::max<uint32_t>(std::max<uint32_t>(static_cast<uint32_t>(((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<uint16_t>(timeDiffMinutes ? timeDiffMinutes : 0);
} else {
msg.add<uint32_t>(std::max<uint32_t>(static_cast<uint32_t>(((slot->freeRerollTimeStamp - OTSYS_TIME()) / 1000)), 0));
msg.addByte(static_cast<uint8_t>(slot->option));
Expand Down

0 comments on commit 364d06a

Please sign in to comment.