unsigned/signed compare warnings

This commit is contained in:
Arthur Dene Ice 2014-05-13 21:37:32 -07:00
parent f82e0e5b4e
commit 4bb5760666
2 changed files with 21 additions and 23 deletions

View File

@ -329,7 +329,7 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAu
newbon->ATK += item->Attack;
}
if(item->DamageShield > 0) {
if((newbon->DamageShield + item->DamageShield) > RuleI(Character, ItemDamageShieldCap))
if((int32)(newbon->DamageShield + item->DamageShield) > RuleI(Character, ItemDamageShieldCap))
newbon->DamageShield = RuleI(Character, ItemDamageShieldCap);
else
newbon->DamageShield += item->DamageShield;
@ -377,7 +377,7 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAu
newbon->ProcChance += item->CombatEffects;
}
if(item->DotShielding > 0) {
if((newbon->DoTShielding + item->DotShielding) > RuleI(Character, ItemDoTShieldingCap))
if((int32)(newbon->DoTShielding + item->DotShielding) > RuleI(Character, ItemDoTShieldingCap))
newbon->DoTShielding = RuleI(Character, ItemDoTShieldingCap);
else
newbon->DoTShielding += item->DotShielding;
@ -396,14 +396,14 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAu
newbon->SpellDmg += item->SpellDmg;
}
if(item->Clairvoyance > 0) {
if((newbon->Clairvoyance + item->Clairvoyance) > RuleI(Character, ItemClairvoyanceCap))
if((int32)(newbon->Clairvoyance + item->Clairvoyance) > RuleI(Character, ItemClairvoyanceCap))
newbon->Clairvoyance = RuleI(Character, ItemClairvoyanceCap);
else
newbon->Clairvoyance += item->Clairvoyance;
}
if(item->DSMitigation > 0) {
if((newbon->DSMitigation + item->DSMitigation) > RuleI(Character, ItemDSMitigationCap))
if((int32)(newbon->DSMitigation + item->DSMitigation) > RuleI(Character, ItemDSMitigationCap))
newbon->DSMitigation = RuleI(Character, ItemDSMitigationCap);
else
newbon->DSMitigation += item->DSMitigation;
@ -519,7 +519,7 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAu
}
if (item->ExtraDmgSkill != 0 && item->ExtraDmgSkill <= HIGHEST_SKILL) {
if((newbon->SkillDamageAmount[item->ExtraDmgSkill] + item->ExtraDmgAmt) > RuleI(Character, ItemExtraDmgCap))
if((int32)(newbon->SkillDamageAmount[item->ExtraDmgSkill] + item->ExtraDmgAmt) > RuleI(Character, ItemExtraDmgCap))
newbon->SkillDamageAmount[item->ExtraDmgSkill] = RuleI(Character, ItemExtraDmgCap);
else
newbon->SkillDamageAmount[item->ExtraDmgSkill] += item->ExtraDmgAmt;
@ -990,7 +990,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
case SE_SpellOnKill:
for(int i = 0; i < MAX_SPELL_TRIGGER*3; i+=3)
{
if(!newbon->SpellOnKill[i] || ((newbon->SpellOnKill[i] == base2) && (newbon->SpellOnKill[i+1] < base1)))
if(!newbon->SpellOnKill[i] || ((newbon->SpellOnKill[i] == base2) && ((int32)newbon->SpellOnKill[i+1] < base1)))
{
//base1 = chance, base2 = SpellID to be triggered, base3 = min npc level
newbon->SpellOnKill[i] = base2;
@ -1248,14 +1248,12 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
void Mob::CalcSpellBonuses(StatBonuses* newbon)
{
int i;
memset(newbon, 0, sizeof(StatBonuses));
newbon->AggroRange = -1;
newbon->AssistRange = -1;
uint32 buff_count = GetMaxTotalSlots();
for(i = 0; i < buff_count; i++) {
for(uint32 i = 0; i < buff_count; i++) {
if(buffs[i].spellid != SPELL_UNKNOWN){
ApplySpellsBonuses(buffs[i].spellid, buffs[i].casterlevel, newbon, buffs[i].casterid, false, buffs[i].ticsremaining,i);
@ -1270,7 +1268,7 @@ void Mob::CalcSpellBonuses(StatBonuses* newbon)
//Removes the spell bonuses that are effected by a 'negate' debuff.
if (spellbonuses.NegateEffects){
for(i = 0; i < buff_count; i++) {
for(uint32 i = 0; i < buff_count; i++) {
if( (buffs[i].spellid != SPELL_UNKNOWN) && (IsEffectInSpell(buffs[i].spellid, SE_NegateSpellEffect)) )
NegateSpellsBonuses(buffs[i].spellid);
}
@ -2290,7 +2288,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
case SE_TriggerMeleeThreshold:
{
if (newbon->TriggerMeleeThreshold[2] < base2){
if (newbon->TriggerMeleeThreshold[2] < (uint32)base2){
newbon->TriggerMeleeThreshold[0] = effect_value;
newbon->TriggerMeleeThreshold[1] = buffslot;
newbon->TriggerMeleeThreshold[2] = base2;
@ -2300,7 +2298,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
case SE_TriggerSpellThreshold:
{
if (newbon->TriggerSpellThreshold[2] < base2){
if (newbon->TriggerSpellThreshold[2] < (uint32)base2){
newbon->TriggerSpellThreshold[0] = effect_value;
newbon->TriggerSpellThreshold[1] = buffslot;
newbon->TriggerSpellThreshold[2] = base2;
@ -2684,7 +2682,7 @@ void NPC::CalcItemBonuses(StatBonuses *newbon)
if (cur->Worn.Effect>0 && (cur->Worn.Type == ET_WornEffect)) { // latent effects
ApplySpellsBonuses(cur->Worn.Effect, cur->Worn.Level, newbon);
}
if (cur->Haste > newbon->haste)
if (cur->Haste > (uint32)newbon->haste)
newbon->haste = cur->Haste;
}
}
@ -2724,8 +2722,8 @@ void Client::CalcItemScale()
bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y)
{
bool changed = false;
int i;
for (i = slot_x; i < slot_y; i++) {
for (uint32 i = slot_x; i < slot_y; i++) {
ItemInst* inst = m_inv.GetItem(i);
if(inst == 0)
continue;
@ -2802,7 +2800,7 @@ void Client::DoItemEnterZone() {
bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
bool changed = false;
for(int i = slot_x; i < slot_y; i++) {
for(uint32 i = slot_x; i < slot_y; i++) {
ItemInst* inst = m_inv.GetItem(i);
if(!inst)
continue;

View File

@ -241,8 +241,8 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id)
{
timeval tv;
gettimeofday(&tv, nullptr);
uint32 resStart = atoi(row[0]);
uint32 resDuration = atoi(row[1]);
int32 resStart = atoi(row[0]);
int32 resDuration = atoi(row[1]);
//compare our values to current time
if((resStart + resDuration) <= tv.tv_sec)
@ -2588,7 +2588,7 @@ void ZoneDatabase::SaveBuffs(Client *c) {
uint32 buff_count = c->GetMaxBuffSlots();
Buffs_Struct *buffs = c->GetBuffs();
for (int i = 0; i < buff_count; i++) {
for (uint32 i = 0; i < buff_count; i++) {
if(buffs[i].spellid != SPELL_UNKNOWN) {
if(!database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO `character_buffs` (character_id, slot_id, spell_id, "
"caster_level, caster_name, ticsremaining, counters, numhits, melee_rune, magic_rune, persistent, dot_rune, "
@ -2607,7 +2607,7 @@ void ZoneDatabase::SaveBuffs(Client *c) {
void ZoneDatabase::LoadBuffs(Client *c) {
Buffs_Struct *buffs = c->GetBuffs();
uint32 max_slots = c->GetMaxBuffSlots();
for(int i = 0; i < max_slots; ++i) {
for(uint32 i = 0; i < max_slots; ++i) {
buffs[i].spellid = SPELL_UNKNOWN;
}
@ -2624,7 +2624,7 @@ void ZoneDatabase::LoadBuffs(Client *c) {
safe_delete_array(query);
while ((row = mysql_fetch_row(result)))
{
uint32 slot_id = atoul(row[1]);
int slot_id = atoul(row[1]);
if(slot_id >= c->GetMaxBuffSlots()) {
continue;
}
@ -2684,7 +2684,7 @@ void ZoneDatabase::LoadBuffs(Client *c) {
}
max_slots = c->GetMaxBuffSlots();
for(int i = 0; i < max_slots; ++i) {
for(uint32 i = 0; i < max_slots; ++i) {
if(!IsValidSpell(buffs[i].spellid)) {
continue;
}
@ -2877,7 +2877,7 @@ void ZoneDatabase::LoadPetInfo(Client *c) {
else
continue;
uint32 slot_id = atoul(row[1]);
int32 slot_id = atoul(row[1]);
if(slot_id >= RuleI(Spells, MaxTotalSlotsPET)) {
continue;
}