From 5c67b0b55b16b3f0123287cfbd2df68e42b24321 Mon Sep 17 00:00:00 2001 From: Arthur Dene Ice Date: Fri, 9 May 2014 21:15:19 -0700 Subject: [PATCH] implicit conversions into explicit ones --- zone/bonuses.cpp | 2 +- zone/spell_effects.cpp | 51 +++++++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 7acf52c4c..9afabf917 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -320,7 +320,7 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAu if(item->Attack > 0) { - int cap = RuleI(Character, ItemATKCap); + uint32 cap = RuleI(Character, ItemATKCap); cap += itembonuses.ItemATKCap + spellbonuses.ItemATKCap + aabonuses.ItemATKCap; if((newbon->ATK + item->Attack) > cap) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 708da7964..9df097f4a 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -324,10 +324,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) //this is in the wrong spot, it should be in the immune //section so the buff timer does not get refreshed! - int i; bool inuse = false; uint32 buff_count = GetMaxTotalSlots(); - for(i = 0; i < buff_count; i++) { + for(uint32 i = 0; i < buff_count; i++) { if(buffs[i].spellid == spell_id && i != buffslot) { Message(0, "You must wait before you can be affected by this spell again."); inuse = true; @@ -1041,7 +1040,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } uint32 buff_count = GetMaxTotalSlots(); - for(int slot = 0; slot < buff_count; slot++) { + for(uint32 slot = 0; slot < buff_count; slot++) { if( buffs[slot].spellid != SPELL_UNKNOWN && spells[buffs[slot].spellid].dispel_flag == 0 && !IsDiscipline(buffs[slot].spellid)) @@ -1066,7 +1065,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } uint32 buff_count = GetMaxTotalSlots(); - for(int slot = 0; slot < buff_count; slot++) { + for(uint32 slot = 0; slot < buff_count; slot++) { if (buffs[slot].spellid != SPELL_UNKNOWN && IsDetrimentalSpell(buffs[slot].spellid) && spells[buffs[slot].spellid].dispel_flag == 0) @@ -1091,7 +1090,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } uint32 buff_count = GetMaxTotalSlots(); - for(int slot = 0; slot < buff_count; slot++) { + for(uint32 slot = 0; slot < buff_count; slot++) { if (buffs[slot].spellid != SPELL_UNKNOWN && IsBeneficialSpell(buffs[slot].spellid) && spells[buffs[slot].spellid].dispel_flag == 0) @@ -1109,7 +1108,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) { //Attempt to remove all Deterimental buffs. uint32 buff_count = GetMaxTotalSlots(); - for(int slot = 0; slot < buff_count; slot++) { + for(uint32 slot = 0; slot < buff_count; slot++) { if (buffs[slot].spellid != SPELL_UNKNOWN && IsDetrimentalSpell(buffs[slot].spellid)) { @@ -1888,12 +1887,12 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) { effect_value = 0 - effect_value; uint32 buff_count = GetMaxTotalSlots(); - for (int j=0; j < buff_count; j++) { + for (uint32 j=0; j < buff_count; j++) { if (buffs[j].spellid >= (uint16)SPDAT_RECORDS) continue; if (CalculatePoisonCounters(buffs[j].spellid) == 0) continue; - if (effect_value >= buffs[j].counters) { + if ((uint32)effect_value >= buffs[j].counters) { if (caster) caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); caster->CastOnCurer(buffs[j].spellid); @@ -1920,12 +1919,12 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) { effect_value = 0 - effect_value; uint32 buff_count = GetMaxTotalSlots(); - for (int j=0; j < buff_count; j++) { + for (uint32 j=0; j < buff_count; j++) { if (buffs[j].spellid >= (uint16)SPDAT_RECORDS) continue; if (CalculateDiseaseCounters(buffs[j].spellid) == 0) continue; - if (effect_value >= buffs[j].counters) + if ((uint32)effect_value >= buffs[j].counters) { if (caster) caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); @@ -1955,12 +1954,12 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) { effect_value = 0 - effect_value; uint32 buff_count = GetMaxTotalSlots(); - for (int j=0; j < buff_count; j++) { + for (uint32 j=0; j < buff_count; j++) { if (buffs[j].spellid >= (uint16)SPDAT_RECORDS) continue; if (CalculateCurseCounters(buffs[j].spellid) == 0) continue; - if (effect_value >= buffs[j].counters) + if ((uint32)effect_value >= buffs[j].counters) { if (caster) caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); @@ -1990,12 +1989,12 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) { effect_value = -effect_value; uint32 buff_count = GetMaxTotalSlots(); - for (int j=0; j < buff_count; j++) { + for (uint32 j=0; j < buff_count; j++) { if (buffs[j].spellid >= (uint16)SPDAT_RECORDS) continue; if (CalculateCorruptionCounters(buffs[j].spellid) == 0) continue; - if (effect_value >= buffs[j].counters) { + if ((uint32)effect_value >= buffs[j].counters) { if (caster) caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); caster->CastOnCurer(buffs[j].spellid); @@ -2486,7 +2485,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) int ratio = spell.base2[i]; uint32 heal_amt = 0; - if (caster->GetMana() <= max_mana){ + if ((uint32)caster->GetMana() <= max_mana){ heal_amt = ratio*caster->GetMana()/10; caster->SetMana(0); } @@ -2619,7 +2618,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) int32 dmg = 0; if (caster){ - if (caster->GetMana() <= max_mana){ + if ((uint32)caster->GetMana() <= max_mana){ dmg = ratio*caster->GetMana()/10; caster->SetMana(0); } @@ -3145,7 +3144,7 @@ void Mob::BuffProcess() { uint32 buff_count = GetMaxTotalSlots(); - for (int buffs_i = 0; buffs_i < buff_count; ++buffs_i) + for (uint32 buffs_i = 0; buffs_i < buff_count; ++buffs_i) { if (buffs[buffs_i].spellid != SPELL_UNKNOWN) { @@ -4104,12 +4103,12 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) break; case SE_LimitCastTimeMin: - if (spell.cast_time < base1) + if (spell.cast_time < (uint32)base1) LimitFailure = true; break; case SE_LimitCastTimeMax: - if (spell.cast_time > base1) + if (spell.cast_time > (uint32)base1) LimitFailure = true; break; @@ -4970,7 +4969,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { //Spell Focus if (spellbonuses.FocusEffects[type]){ - int buff_slot = 0; + uint32 buff_slot = 0; uint16 focusspellid = 0; uint32 buff_max = GetMaxTotalSlots(); for (buff_slot = 0; buff_slot < buff_max; buff_slot++) { @@ -5156,7 +5155,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) { int16 focus_max_real2 = 0; int buff_tracker = -1; - int buff_slot = 0; + uint32 buff_slot = 0; uint16 focusspellid = 0; uint16 focusspell_tracker = 0; uint32 buff_max = GetMaxTotalSlots(); @@ -5288,7 +5287,7 @@ void Mob::CheckNumHitsRemaining(uint8 type, uint32 buff_slot, uint16 spell_id) else { - for(int d = 0; d < buff_max; d++) { + for(uint32 d = 0; d < buff_max; d++) { if(!m_spellHitsLeft[d]) continue; @@ -5428,7 +5427,7 @@ bool Mob::TryDeathSave() { if (spellbonuses.DeathSave[3] && (GetLevel() >= spellbonuses.DeathSave[2])) HealAmt += spellbonuses.DeathSave[3]; - if ((GetMaxHP() - GetHP()) < HealAmt) + if ((uint32)(GetMaxHP() - GetHP()) < HealAmt) HealAmt = GetMaxHP() - GetHP(); SetHP((GetHP()+HealAmt)); @@ -5461,7 +5460,7 @@ bool Mob::TryDeathSave() { HealAmt = HealAmt*UD_HealMod/100; - if ((GetMaxHP() - GetHP()) < HealAmt) + if ((uint32)(GetMaxHP() - GetHP()) < HealAmt) HealAmt = GetMaxHP() - GetHP(); SetHP((GetHP()+HealAmt)); @@ -5535,7 +5534,7 @@ int32 Mob::GetFcDamageAmtIncoming(Mob *caster, uint32 spell_id, bool use_skill, if (spellbonuses.FocusEffects[focusFcDamageAmtIncoming]){ uint32 buff_count = GetMaxTotalSlots(); - for(int i = 0; i < buff_count; i++){ + for(uint32 i = 0; i < buff_count; i++){ if( (IsValidSpell(buffs[i].spellid) && (IsEffectInSpell(buffs[i].spellid, SE_FcDamageAmtIncoming))) ){ @@ -5592,7 +5591,7 @@ int32 Mob::GetFocusIncoming(focusType type, int effect, Mob *caster, uint32 spel if (spellbonuses.FocusEffects[type]){ uint32 buff_count = GetMaxTotalSlots(); - for(int i = 0; i < buff_count; i++){ + for(uint32 i = 0; i < buff_count; i++){ int32 tmp_focus = 0; int tmp_buffslot = -1;