aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorSpp <none@none>2010-08-30 15:25:15 +0200
committerSpp <none@none>2010-08-30 15:25:15 +0200
commit405f312918136510fde921403ffffa315bdbcb4b (patch)
tree1543ab9fe023fcb6ce03d31070917cff527b2e88 /src/server/game/Entities
parentb0d85ac1858ecc162adb08a8de1b3da68121ce64 (diff)
Core: Fix more warnings
--HG-- branch : trunk
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp2
-rw-r--r--src/server/game/Entities/Creature/TemporarySummon.cpp2
-rw-r--r--src/server/game/Entities/Item/Item.cpp2
-rw-r--r--src/server/game/Entities/Object/Object.cpp3
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp2
-rw-r--r--src/server/game/Entities/Player/Player.cpp8
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp16
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp37
8 files changed, 39 insertions, 33 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 727ffef5708..4535e9853ad 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -2360,7 +2360,7 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
time_t ptime = time(NULL);
- if (vCount->lastIncrementTime + vItem->incrtime <= ptime)
+ if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
{
ItemPrototype const* pProto = sObjectMgr.GetItemPrototype(vItem->item);
diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp
index 33598c6b39c..20d3806cc18 100644
--- a/src/server/game/Entities/Creature/TemporarySummon.cpp
+++ b/src/server/game/Entities/Creature/TemporarySummon.cpp
@@ -295,7 +295,7 @@ void Minion::RemoveFromWorld()
bool Minion::IsGuardianPet() const
{
- return isPet() || m_Properties && m_Properties->Category == SUMMON_CATEGORY_PET;
+ return isPet() || (m_Properties && m_Properties->Category == SUMMON_CATEGORY_PET);
}
Guardian::Guardian(SummonPropertiesEntry const *properties, Unit *owner) : Minion(properties, owner)
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 4e615052cba..ab54522de7a 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -1000,7 +1000,7 @@ uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const
bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const
{
ItemPrototype const* proto = GetProto();
- return proto && (proto->Map && proto->Map != cur_mapId || proto->Area && proto->Area != cur_zoneId);
+ return proto && ((proto->Map && proto->Map != cur_mapId) || (proto->Area && proto->Area != cur_zoneId));
}
// Though the client has the information in the item's data field,
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 13a648d131d..271a523a611 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -2370,8 +2370,7 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
float step = dist/10.0f;
- int j = 0;
- for (j; j < 10; j++)
+ for (uint8 j = 0; j < 10; ++j)
{
// do not allow too big z changes
if (fabs(pos.m_positionZ - destz) > 6)
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 87ac7627f96..7286512bce6 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -615,7 +615,7 @@ void Creature::Regenerate(Powers power)
// Apply modifiers (if any).
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
- if ((*i)->GetMiscValue() == power)
+ if (Powers((*i)->GetMiscValue()) == power)
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, power) * (isHunterPet()? PET_FOCUS_REGEN_INTERVAL : CREATURE_REGEN_INTERVAL) / (5 * IN_MILLISECONDS);
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 06b5a7fd33b..322899f8b74 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -2237,7 +2237,7 @@ void Player::Regenerate(Powers power)
{
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
- if ((*i)->GetMiscValue() == power)
+ if (Powers((*i)->GetMiscValue()) == power)
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
// Butchery requires combat for this effect
@@ -17484,7 +17484,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
if (sDisableMgr.IsDisabledFor(DISABLE_TYPE_MAP, target_map, this))
{
- GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_INSTANCE_CLOSED));
+ GetSession()->SendAreaTriggerMessage("%s", GetSession()->GetTrinityString(LANG_INSTANCE_CLOSED));
return false;
}
@@ -17505,7 +17505,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
if (report)
{
if (missingQuest && !ar->questFailedText.empty())
- ChatHandler(GetSession()).PSendSysMessage(ar->questFailedText.c_str());
+ ChatHandler(GetSession()).PSendSysMessage("%s", ar->questFailedText.c_str());
else if (mapDiff->hasErrorMessage) // if (missingAchievement) covered by this case
SendTransferAborted(target_map, TRANSFER_ABORT_DIFFICULTY, target_difficulty);
else if (missingItem)
@@ -18256,7 +18256,7 @@ void Player::SavePositionInDB(uint32 mapid, float x,float y,float z,float o,uint
<< "',position_z='"<<z<<"',orientation='"<<o<<"',map='"<<mapid
<< "',zone='"<<zone<<"',trans_x='0',trans_y='0',trans_z='0',"
<< "transguid='0',taxi_path='' WHERE guid='"<< GUID_LOPART(guid) <<"'";
- sLog.outDebug(ss.str().c_str());
+ sLog.outDebug("%s", ss.str().c_str());
CharacterDatabase.Execute(ss.str().c_str());
}
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index e6e588e1b59..0de9be51480 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -155,10 +155,10 @@ void Player::UpdateSpellDamageAndHealingBonus()
bool Player::UpdateAllStats()
{
- for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
+ for (int8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
float value = GetTotalStatValue(Stats(i));
- SetStat(Stats(i), (int32)value);
+ SetStat(Stats(i), int32(value));
}
UpdateArmor();
@@ -166,7 +166,7 @@ bool Player::UpdateAllStats()
UpdateAttackPowerAndDamage(true);
UpdateMaxHealth();
- for (int i = POWER_MANA; i < MAX_POWERS; ++i)
+ for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
UpdateMaxPower(Powers(i));
UpdateAllRatings();
@@ -790,10 +790,10 @@ bool Creature::UpdateAllStats()
UpdateAttackPowerAndDamage();
UpdateAttackPowerAndDamage(true);
- for (int i = POWER_MANA; i < MAX_POWERS; ++i)
+ for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
UpdateMaxPower(Powers(i));
- for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
+ for (int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
UpdateResistances(i);
return true;
@@ -1036,13 +1036,13 @@ bool Guardian::UpdateStats(Stats stat)
bool Guardian::UpdateAllStats()
{
- for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
+ for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
UpdateStats(Stats(i));
- for (int i = POWER_MANA; i < MAX_POWERS; ++i)
+ for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
UpdateMaxPower(Powers(i));
- for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
+ for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
UpdateResistances(i);
return true;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 96a8e798696..74f5b5f469a 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -3274,7 +3274,11 @@ uint32 Unit::GetWeaponSkillValue (WeaponAttackType attType, Unit const* target)
return GetMaxSkillValueForLevel(); // always maximized SKILL_FERAL_COMBAT in fact
// weapon skill or (unarmed for base attack and fist weapons)
- uint32 skill = item && item->GetSkill() != SKILL_FIST_WEAPONS ? item->GetSkill() : SKILL_UNARMED;
+ uint32 skill;
+ if (item && item->GetSkill() != SKILL_FIST_WEAPONS)
+ skill = item->GetSkill();
+ else
+ skill = SKILL_UNARMED;
// in PvP use full skill instead current skill value
value = (target && target->IsControlledByPlayer())
@@ -7350,9 +7354,12 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
{
if (ToPlayer()->HasSpellCooldown(16166))
{
- uint32 newCooldownDelay = ToPlayer()->GetSpellCooldownDelay(16166) - 2;
- if (newCooldownDelay < 0) newCooldownDelay = 0;
- ToPlayer()->AddSpellCooldown(16166,0, uint32(time(NULL) + newCooldownDelay));
+ uint32 newCooldownDelay = ToPlayer()->GetSpellCooldownDelay(16166);
+ if (newCooldownDelay < 3)
+ newCooldownDelay = 0;
+ else
+ newCooldownDelay -= 2;
+ ToPlayer()->AddSpellCooldown(16166,0, uint32(time(NULL) + newCooldownDelay));
WorldPacket data(SMSG_MODIFY_COOLDOWN, 4+8+4);
data << uint32(16166); // Spell ID
@@ -9636,7 +9643,7 @@ Guardian* Unit::GetGuardianPet() const
if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
return (Guardian*)pet;
- sLog.outCrash("Unit::GetGuardianPet: Guardian " I64FMT " not exist.", pet_guid);
+ sLog.outCrash("Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid);
const_cast<Unit*>(this)->SetPetGUID(0);
}
@@ -9848,7 +9855,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
if (GetTypeId() == TYPEID_PLAYER)
{
if (!AddUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID()))
- sLog.outCrash("Player %s is trying to charm unit %u, but it already has a charmed unit %u", GetName(), charm->GetEntry(), GetCharmGUID());
+ sLog.outCrash("Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName(), charm->GetEntry(), GetCharmGUID());
charm->m_ControlledByPlayer = true;
// TODO: maybe we can use this flag to check if controlled by player
@@ -9861,7 +9868,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
if (!charm->AddUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
- sLog.outCrash("Unit %u is being charmed, but it already has a charmer %u", charm->GetEntry(), charm->GetCharmerGUID());
+ sLog.outCrash("Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
if (charm->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
{
@@ -9876,11 +9883,11 @@ void Unit::SetCharm(Unit* charm, bool apply)
if (GetTypeId() == TYPEID_PLAYER)
{
if (!RemoveUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID()))
- sLog.outCrash("Player %s is trying to uncharm unit %u, but it has another charmed unit %u", GetName(), charm->GetEntry(), GetCharmGUID());
+ sLog.outCrash("Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName(), charm->GetEntry(), GetCharmGUID());
}
if (!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
- sLog.outCrash("Unit %u is being uncharmed, but it has another charmer %u", charm->GetEntry(), charm->GetCharmerGUID());
+ sLog.outCrash("Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
if (charm->GetTypeId() == TYPEID_PLAYER)
{
@@ -10011,11 +10018,11 @@ void Unit::RemoveAllControlled()
sLog.outError("Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry());
}
if (GetPetGUID())
- sLog.outCrash("Unit %u is not able to release its pet " I64FMT, GetEntry(), GetPetGUID());
+ sLog.outCrash("Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID());
if (GetMinionGUID())
- sLog.outCrash("Unit %u is not able to release its minion " I64FMT, GetEntry(), GetMinionGUID());
+ sLog.outCrash("Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID());
if (GetCharmGUID())
- sLog.outCrash("Unit %u is not able to release its charm " I64FMT, GetEntry(), GetCharmGUID());
+ sLog.outCrash("Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID());
}
Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
@@ -11117,7 +11124,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if (spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ||
- spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH)
+ (spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH))
{
CastingTime /= 2;
break;
@@ -14718,7 +14725,7 @@ void Unit::SetContestedPvP(Player *attackedPlayer)
{
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();
- if (!player || (attackedPlayer && (attackedPlayer == player || player->duel && player->duel->opponent == attackedPlayer)))
+ if (!player || (attackedPlayer && (attackedPlayer == player || (player->duel && player->duel->opponent == attackedPlayer))))
return;
player->SetContestedPvPTimer(30000);
@@ -15179,7 +15186,7 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
// only if not player and not controlled by player pet. And not at BG
if ((durabilityLoss && !player && !pVictim->ToPlayer()->InBattleground()) || (player && sWorld.getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP)))
{
- sLog.outStaticDebug("We are dead, losing %u percent durability", sWorld.getRate(RATE_DURABILITY_LOSS_ON_DEATH));
+ sLog.outStaticDebug("We are dead, losing %f percent durability", sWorld.getRate(RATE_DURABILITY_LOSS_ON_DEATH));
pVictim->ToPlayer()->DurabilityLossAll(sWorld.getRate(RATE_DURABILITY_LOSS_ON_DEATH),false);
// durability lost message
WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 0);