[Bug Fix] Use std::clamp for Mob::ChangeSize (#4140)

Helper template was not deducing float for lower/upper values allowing invalid sizes
Limit to sane values of 1-255 unrestricted and 3-15 for clients and pets
This commit is contained in:
JJ 2024-03-01 19:46:00 -08:00 committed by GitHub
parent c3d8d423fe
commit 79c8858ec8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4384,17 +4384,15 @@ void Mob::SendWearChangeAndLighting(int8 last_texture) {
void Mob::ChangeSize(float in_size = 0, bool unrestricted) void Mob::ChangeSize(float in_size = 0, bool unrestricted)
{ {
size = std::clamp(in_size, 1.0f, 255.0f);
if (!unrestricted) { if (!unrestricted) {
if (IsClient() || petid != 0) { if (IsClient() || petid != 0) {
EQ::Clamp(in_size, 3.0f, 15.0f); size = std::clamp(in_size, 3.0f, 15.0f);
} }
} }
EQ::Clamp(in_size, 1.0f, 255.0f); SendAppearancePacket(AppearanceType::Size, static_cast<uint32>(size));
size = in_size;
SendAppearancePacket(AppearanceType::Size, static_cast<uint32>(in_size));
} }
Mob* Mob::GetOwnerOrSelf() Mob* Mob::GetOwnerOrSelf()