mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 06:21:28 +00:00
[Cleanup] Fix possible overflows in Client::AddPlatinum() and Client::TakePlatinum() (#3255)
# Notes - Fix possible overflows by casting properly.
This commit is contained in:
parent
2a094e8792
commit
c1698a5bdd
@ -2222,7 +2222,7 @@ uint32 Client::GetCarriedPlatinum() {
|
||||
|
||||
bool Client::TakePlatinum(uint32 platinum, bool update_client) {
|
||||
if (GetCarriedPlatinum() >= platinum) {
|
||||
auto copper = static_cast<uint64>(platinum * 1000);
|
||||
const auto copper = static_cast<uint64>(platinum) * 1000;
|
||||
return TakeMoneyFromPP(copper, update_client);
|
||||
}
|
||||
|
||||
@ -2316,7 +2316,7 @@ bool Client::TakeMoneyFromPP(uint64 copper, bool update_client) {
|
||||
}
|
||||
|
||||
void Client::AddPlatinum(uint32 platinum, bool update_client) {
|
||||
auto copper = static_cast<uint64>(platinum * 1000);
|
||||
const auto copper = static_cast<uint64>(platinum) * 1000;
|
||||
AddMoneyToPP(copper, update_client);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user