mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +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:
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user