[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:
balrok 2009-09-05 10:42:36 +02:00
parent 56ddf40d62
commit bd30769dec
36 changed files with 96 additions and 101 deletions

View file

@ -111,7 +111,7 @@ bool SpellClickInfo::IsFitToRequirements(Player const* player) const
if(questStart)
{
// not in expected required quest state
if(!player || (!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart))
if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)))
return false;
}
@ -782,8 +782,8 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
// replace by new structures array
const_cast<CreatureDataAddonAura*&>(addon->auras) = new CreatureDataAddonAura[val.size()/2+1];
int i=0;
for(int j=0;j<val.size()/2;++j)
uint32 i=0;
for(uint32 j = 0; j < val.size()/2; ++j)
{
CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
cAura.spell_id = (uint32)val[2*j+0];
@ -1082,7 +1082,7 @@ void ObjectMgr::LoadCreatures()
if(heroicCreatures.find(data.id)!=heroicCreatures.end())
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as heroic template in `creature_template`, skipped.",guid,data.id );
sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as heroic template (entry: %u) in `creature_template`, skipped.",guid, data.id );
continue;
}
@ -3464,8 +3464,8 @@ void ObjectMgr::LoadQuests()
bool found = false;
for(int k = 0; k < 3; ++k)
{
if( spellInfo->Effect[k]==SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k])==qinfo->QuestId ||
spellInfo->Effect[k]==SPELL_EFFECT_SEND_EVENT)
if ((spellInfo->Effect[k] == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k]) == qinfo->QuestId) ||
spellInfo->Effect[k] == SPELL_EFFECT_SEND_EVENT)
{
found = true;
break;
@ -7080,7 +7080,10 @@ bool PlayerCondition::Meets(Player const * player) const
case CONDITION_REPUTATION_RANK:
{
FactionEntry const* faction = sFactionStore.LookupEntry(value1);
return faction && player->GetReputationMgr().GetRank(faction) >= value2;
// -1 used if faction couldn't be found
if (player->GetReputationMgr().GetRank(faction) == -1)
return false;
return faction && uint32(player->GetReputationMgr().GetRank(faction)) >= value2;
}
case CONDITION_TEAM:
return player->GetTeam() == value1;