[Fix] FixHeading Infinite Loop Fix (#4854)

Co-authored-by: KimLS <KimLS@peqtgc.com>
This commit is contained in:
Alex 2025-04-09 18:55:35 -07:00 committed by GitHub
parent cc30c72538
commit f9fe4ea2ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -933,16 +933,11 @@ void MobMovementManager::SendCommandToClients(
float MobMovementManager::FixHeading(float in) float MobMovementManager::FixHeading(float in)
{ {
auto h = in; int h = static_cast<int>(in) % 512;
while (h > 512.0) { if (h < 0) {
h -= 512.0; h += 512;
} }
return static_cast<float>(h);
while (h < 0.0) {
h += 512.0;
}
return h;
} }
void MobMovementManager::DumpStats(Client *client) void MobMovementManager::DumpStats(Client *client)