mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[8475] fixed some gcc-warnings
all warnings from Wunused
and some from Wall
cause unused may be most interesting for some:
they were in following files:
src/game/Level2.cpp
src/game/Map.cpp
src/game/SpellAuras.cpp
src/game/Unit.cpp
src/mangosd/Master.cpp
but i guess mostly someone just fogot to remove this code
for some unsigned vs signed warnings i used:
ack "for.*int .*size\(\)" | ack -v uint
also note for coding:
if you do something like
if( a && b || c)
just place parentheses around (a && b) && always will have
precedence over || but without parentheses this could be overseen
quite fast (at least that's my guess why gcc will warn for this)
Signed-off-by: balrok <der-coole-carl@gmx.net>
This commit is contained in:
parent
56ddf40d62
commit
bd30769dec
36 changed files with 96 additions and 101 deletions
|
|
@ -776,9 +776,9 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
|
|||
|
||||
void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen)
|
||||
{
|
||||
if (MaxValue == DISABLED_MIRROR_TIMER)
|
||||
if (int(MaxValue) == DISABLED_MIRROR_TIMER)
|
||||
{
|
||||
if (CurrentValue!=DISABLED_MIRROR_TIMER)
|
||||
if (int(CurrentValue) != DISABLED_MIRROR_TIMER)
|
||||
StopMirrorTimer(Type);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1499,7 +1499,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
|
|||
if(!enchantId)
|
||||
continue;
|
||||
|
||||
if(enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId))
|
||||
if ((enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId)))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -2260,9 +2260,8 @@ bool Player::IsGroupVisibleFor(Player* p) const
|
|||
|
||||
bool Player::IsInSameGroupWith(Player const* p) const
|
||||
{
|
||||
return p==this || GetGroup() != NULL &&
|
||||
GetGroup() == p->GetGroup() &&
|
||||
GetGroup()->SameSubGroup((Player*)this, (Player*)p);
|
||||
return (p==this || (GetGroup() != NULL &&
|
||||
GetGroup()->SameSubGroup((Player*)this, (Player*)p)));
|
||||
}
|
||||
|
||||
///- If the player is invited, remove him. If the group if then only 1 person, disband the group.
|
||||
|
|
@ -3064,7 +3063,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
|||
|
||||
if (_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL ||
|
||||
// lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL
|
||||
(pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0 )
|
||||
((pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0))
|
||||
{
|
||||
switch(GetSkillRangeType(pSkill,_spell_idx->second->racemask!=0))
|
||||
{
|
||||
|
|
@ -3118,7 +3117,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
|
|||
{
|
||||
// note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
|
||||
// talent dependent passives activated at form apply have proper stance data
|
||||
bool need_cast = !spellInfo->Stances || m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)));
|
||||
bool need_cast = (!spellInfo->Stances || (m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)))));
|
||||
|
||||
//Check CasterAuraStates
|
||||
return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)));
|
||||
|
|
@ -3160,7 +3159,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
|
|||
if (itr == m_spells.end())
|
||||
return;
|
||||
|
||||
if(itr->second->state == PLAYERSPELL_REMOVED || disabled && itr->second->disabled)
|
||||
if (itr->second->state == PLAYERSPELL_REMOVED || (disabled && itr->second->disabled))
|
||||
return;
|
||||
|
||||
// unlearn non talent higher ranks (recursive)
|
||||
|
|
@ -3270,7 +3269,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
|
|||
if(_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL &&
|
||||
pSkill->categoryId != SKILL_CATEGORY_CLASS ||// not unlearn class skills (spellbook/talent pages)
|
||||
// lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL
|
||||
(pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0 )
|
||||
((pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0))
|
||||
{
|
||||
// not reset skills for professions and racial abilities
|
||||
if ((pSkill->categoryId==SKILL_CATEGORY_SECONDARY || pSkill->categoryId==SKILL_CATEGORY_PROFESSION) &&
|
||||
|
|
@ -4495,7 +4494,7 @@ void Player::RepopAtGraveyard()
|
|||
AreaTableEntry const *zone = GetAreaEntryByAreaID(GetAreaId());
|
||||
|
||||
// Such zones are considered unreachable as a ghost and the player must be automatically revived
|
||||
if(!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY || GetTransport())
|
||||
if ((!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport())
|
||||
{
|
||||
ResurrectPlayer(0.5f);
|
||||
SpawnCorpseBones();
|
||||
|
|
@ -6736,7 +6735,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
|
|||
// If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage
|
||||
if (ssv)
|
||||
{
|
||||
if (extraDPS = ssv->getDPSMod(proto->ScalingStatValue))
|
||||
if ((extraDPS = ssv->getDPSMod(proto->ScalingStatValue)))
|
||||
{
|
||||
float average = extraDPS * proto->Delay / 1000.0f;
|
||||
minDamage = 0.7f * average;
|
||||
|
|
@ -8459,10 +8458,10 @@ Item* Player::GetItemByPos( uint16 pos ) const
|
|||
|
||||
Item* Player::GetItemByPos( uint8 bag, uint8 slot ) const
|
||||
{
|
||||
if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END ) )
|
||||
if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END )) )
|
||||
return m_items[slot];
|
||||
else if(bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END
|
||||
|| bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END )
|
||||
else if ((bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)
|
||||
|| (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END) )
|
||||
{
|
||||
Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag );
|
||||
if ( pBag )
|
||||
|
|
@ -11095,7 +11094,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
|
|||
if(IsEquipmentPos ( src ) || IsBagPos ( src ))
|
||||
{
|
||||
// bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
|
||||
uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty());
|
||||
uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || (pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty()));
|
||||
if(msg != EQUIP_ERR_OK)
|
||||
{
|
||||
SendEquipError( msg, pSrcItem, pDstItem );
|
||||
|
|
@ -11125,7 +11124,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
|
|||
if(IsEquipmentPos ( dst ) || IsBagPos ( dst ))
|
||||
{
|
||||
// bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
|
||||
uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty());
|
||||
uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || (pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty()));
|
||||
if(msg != EQUIP_ERR_OK)
|
||||
{
|
||||
SendEquipError( msg, pSrcItem, pDstItem );
|
||||
|
|
@ -11543,7 +11542,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly)
|
|||
Item* item = *itr;
|
||||
++itr; // current element can be erased in UpdateDuration
|
||||
|
||||
if (realtimeonly && item->GetProto()->Duration < 0 || !realtimeonly)
|
||||
if ((realtimeonly && item->GetProto()->Duration < 0) || !realtimeonly)
|
||||
item->UpdateDuration(this,time);
|
||||
}
|
||||
}
|
||||
|
|
@ -14066,7 +14065,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
|
||||
// check name limitations
|
||||
if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS ||
|
||||
GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name))
|
||||
(GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name)))
|
||||
{
|
||||
delete result;
|
||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME),guid);
|
||||
|
|
@ -15718,8 +15717,6 @@ void Player::_SaveAuras()
|
|||
// save previous spellEffectPair to db
|
||||
itr2--;
|
||||
|
||||
SpellEntry const *spellInfo = itr2->second->GetSpellProto();
|
||||
|
||||
//skip all auras from spells that are passive
|
||||
//do not save single target auras (unless they were cast by the player)
|
||||
if (!itr2->second->IsPassive() && (itr2->second->GetCasterGUID() == GetGUID() || !itr2->second->IsSingleTarget()))
|
||||
|
|
@ -16989,7 +16986,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
|
|||
uint32 mount_display_id = objmgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == NULL);
|
||||
|
||||
// in spell case allow 0 model
|
||||
if (mount_display_id == 0 && spellid == 0 || sourcepath == 0)
|
||||
if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0)
|
||||
{
|
||||
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
|
||||
data << uint32(ERR_TAXIUNSPECIFIEDSERVERERROR);
|
||||
|
|
@ -19151,8 +19148,8 @@ void Player::UpdateAreaDependentAuras( uint32 newArea )
|
|||
|
||||
uint32 Player::GetCorpseReclaimDelay(bool pvp) const
|
||||
{
|
||||
if( pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) ||
|
||||
!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )
|
||||
if ((pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) ||
|
||||
(!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ))
|
||||
{
|
||||
return copseReclaimDelay[0];
|
||||
}
|
||||
|
|
@ -19167,8 +19164,8 @@ void Player::UpdateCorpseReclaimDelay()
|
|||
{
|
||||
bool pvp = m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH;
|
||||
|
||||
if( pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) ||
|
||||
!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )
|
||||
if ((pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) ||
|
||||
(!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ))
|
||||
return;
|
||||
|
||||
time_t now = time(NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue