int64 to int32 explicit conversions)

This commit is contained in:
Arthur Dene Ice 2014-05-09 17:57:28 -07:00
parent 689897ca39
commit 89fe3b6765
4 changed files with 16 additions and 16 deletions

View File

@ -3832,7 +3832,7 @@ void Mob::HealDamage(uint32 amount, Mob *caster, uint16 spell_id)
if (caster && amount > 0) {
if (caster->IsNPC() && !caster->IsPet()) {
float npchealscale = caster->CastToNPC()->GetHealScale();
amount = (uint32)(amount * npchealscale) / 100.0f);
amount = (uint32)((amount * npchealscale) / 100.0f);
}
}

View File

@ -2133,9 +2133,9 @@ bool Client::TakeMoneyFromPP(uint64 copper, bool updateclient) {
{
m_pp.gold = gold/100;
uint64 silvertest = (gold-(static_cast<uint64>(m_pp.gold)*100))/10;
m_pp.silver += silvertest;
m_pp.silver =(int32)(m_pp.silver + silvertest);
uint64 coppertest = (gold-(static_cast<uint64>(m_pp.gold)*100+silvertest*10));
m_pp.copper += coppertest;
m_pp.copper = (int32)(m_pp.copper + coppertest);
if(updateclient)
SendMoneyUpdate();
Save();
@ -2148,11 +2148,11 @@ bool Client::TakeMoneyFromPP(uint64 copper, bool updateclient) {
m_pp.platinum = platinum/1000;
uint64 goldtest = (platinum-(static_cast<uint64>(m_pp.platinum)*1000))/100;
m_pp.gold += goldtest;
m_pp.gold = (int32)(m_pp.gold +goldtest);
uint64 silvertest = (platinum-(static_cast<uint64>(m_pp.platinum)*1000+goldtest*100))/10;
m_pp.silver += silvertest;
uint64 coppertest = (platinum-(static_cast<uint64>(m_pp.platinum)*1000+goldtest*100+silvertest*10));
m_pp.copper = coppertest;
m_pp.copper = (int32)coppertest;
if(updateclient)
SendMoneyUpdate();
RecalcWeight();
@ -2172,7 +2172,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){
if(new_val < 0) {
m_pp.platinum = 0;
} else {
m_pp.platinum = m_pp.platinum + tmp2;
m_pp.platinum = (int32)(m_pp.platinum + tmp2);
}
tmp-=tmp2*1000;
@ -2181,11 +2181,11 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){
// Add Amount of Gold
tmp2 = tmp/100;
new_val = m_pp.gold + tmp2;
new_val = (int32)(m_pp.gold + tmp2);
if(new_val < 0) {
m_pp.gold = 0;
} else {
m_pp.gold = m_pp.gold + tmp2;
m_pp.gold = (int32)(m_pp.gold + tmp2);
}
tmp-=tmp2*100;
//if (updateclient)
@ -2193,11 +2193,11 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){
// Add Amount of Silver
tmp2 = tmp/10;
new_val = m_pp.silver + tmp2;
new_val = (int32)(m_pp.silver + tmp2);
if(new_val < 0) {
m_pp.silver = 0;
} else {
m_pp.silver = m_pp.silver + tmp2;
m_pp.silver = (int32)(m_pp.silver + tmp2);
}
tmp-=tmp2*10;
//if (updateclient)
@ -2212,7 +2212,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){
if(new_val < 0) {
m_pp.copper = 0;
} else {
m_pp.copper = m_pp.copper + tmp2;
m_pp.copper = (int32)(m_pp.copper + tmp2);
}

View File

@ -9798,7 +9798,7 @@ void Client::Handle_OP_BankerChange(const EQApplicationPacket *app)
cp/=10;
m_pp.gold=cp%10;
cp/=10;
m_pp.platinum=cp;
m_pp.platinum=(int32)cp;
cp = static_cast<uint64>(m_pp.copper_bank) +
(static_cast<uint64>(m_pp.silver_bank) * 10) +
@ -9811,7 +9811,7 @@ void Client::Handle_OP_BankerChange(const EQApplicationPacket *app)
cp/=10;
m_pp.gold_bank=cp%10;
cp/=10;
m_pp.platinum_bank=cp;
m_pp.platinum_bank=(int32)cp;
bc->copper=m_pp.copper;
bc->silver=m_pp.silver;

View File

@ -1528,14 +1528,14 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
// now we actually take it from the from bucket. if there's an error
// with the destination slot, they lose their money
*from_bucket -= amount_to_take;
*from_bucket = (int32)(*from_bucket - amount_to_take);
// why are intentionally inducing a crash here rather than letting the code attempt to stumble on?
// assert(*from_bucket >= 0);
if(to_bucket)
{
if(*to_bucket + amount_to_add > *to_bucket) // overflow check
*to_bucket += amount_to_add;
*to_bucket = (int32)(*to_bucket+amount_to_add);
//shared bank plat
if (RuleB(Character, SharedBankPlat))
@ -1573,7 +1573,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
tcs->slot = mc->cointype2;
tcs->unknown5 = 0x4fD2;
tcs->unknown7 = 0;
tcs->amount = amount_to_add;
tcs->amount = (uint32)amount_to_add;
recipient->QueuePacket(outapp);
safe_delete(outapp);
}