[Stats] Shorten size calculation

This commit is contained in:
momo5502 2017-02-28 16:56:14 +01:00
parent a057552afc
commit f4bbfdf102

View File

@ -40,15 +40,10 @@ namespace Components
// Stat packet index // Stat packet index
Game::MSG_WriteByte(&msg, i); Game::MSG_WriteByte(&msg, i);
// calculate packet size
size_t size = 8192 - (i * 1240);
if (size > 1240)
size = 1240;
// write stat packet data // write stat packet data
if (statbuffer) if (statbuffer)
{ {
Game::MSG_WriteData(&msg, statbuffer, size); Game::MSG_WriteData(&msg, statbuffer, std::min(8192 - (i * 1240), 1240));
} }
// send statpacket // send statpacket