Core&Scripts: Fix clang compiler warnings

This commit is contained in:
Nay
2013-08-27 23:47:03 +01:00
parent e5dc70118a
commit 78786c7b54
15 changed files with 22 additions and 40 deletions
+6 -6
View File
@@ -972,7 +972,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
if (!IsValidGender(createInfo->Gender))
{
TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so",
TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%u) - refusing to do so",
GetSession()->GetAccountId(), m_name.c_str(), createInfo->Gender);
return false;
}
@@ -1918,7 +1918,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data)
}
else if (!IsValidGender(gender))
{
TC_LOG_ERROR(LOG_FILTER_PLAYER_LOADING, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender);
TC_LOG_ERROR(LOG_FILTER_PLAYER_LOADING, "Player (%u) has incorrect gender (%u), don't build enum.", guid, gender);
return false;
}
@@ -17018,10 +17018,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// overwrite possible wrong/corrupted guid
SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
uint8 Gender = fields[5].GetUInt8();
if (!IsValidGender(Gender))
uint8 gender = fields[5].GetUInt8();
if (!IsValidGender(gender))
{
TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (GUID: %u) has wrong gender (%hu), can't be loaded.", guid, Gender);
TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (GUID: %u) has wrong gender (%u), can't be loaded.", guid, gender);
return false;
}
@@ -17029,7 +17029,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
uint32 bytes0 = 0;
bytes0 |= fields[3].GetUInt8(); // race
bytes0 |= fields[4].GetUInt8() << 8; // class
bytes0 |= Gender << 16; // gender
bytes0 |= gender << 16; // gender
SetUInt32Value(UNIT_FIELD_BYTES_0, bytes0);
SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
+1 -3
View File
@@ -3045,8 +3045,6 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool withInstant)
{
ASSERT(spellType < CURRENT_MAX_SPELL);
//TC_LOG_DEBUG(LOG_FILTER_UNITS, "Interrupt spell for unit %u.", GetEntry());
Spell* spell = m_currentSpells[spellType];
if (spell
@@ -13991,7 +13989,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
Unit* actionTarget = !isVictim ? target : this;
DamageInfo damageInfo = DamageInfo(actor, actionTarget, damage, procSpell, procSpell ? SpellSchoolMask(procSpell->SchoolMask) : SPELL_SCHOOL_MASK_NORMAL, SPELL_DIRECT_DAMAGE);
HealInfo healInfo = HealInfo(actor, actionTarget, damage, procSpell, procSpell ? SpellSchoolMask(procSpell->SchoolMask) : SPELL_SCHOOL_MASK_NORMAL);
HealInfo healInfo = HealInfo(damage);
ProcEventInfo eventInfo = ProcEventInfo(actor, actionTarget, target, procFlag, 0, 0, procExtra, NULL, &damageInfo, &healInfo);
ProcTriggeredList procTriggered;
+4 -9
View File
@@ -470,11 +470,10 @@ enum BaseModGroup
enum BaseModType
{
FLAT_MOD,
PCT_MOD
PCT_MOD,
MOD_END
};
#define MOD_END (PCT_MOD+1)
enum DeathState
{
ALIVE = 0,
@@ -871,15 +870,11 @@ public:
class HealInfo
{
private:
Unit* const m_healer;
Unit* const m_target;
uint32 m_heal;
uint32 m_absorb;
SpellInfo const* const m_spellInfo;
SpellSchoolMask const m_schoolMask;
public:
explicit HealInfo(Unit* _healer, Unit* _target, uint32 _heal, SpellInfo const* _spellInfo, SpellSchoolMask _schoolMask)
: m_healer(_healer), m_target(_target), m_heal(_heal), m_spellInfo(_spellInfo), m_schoolMask(_schoolMask)
explicit HealInfo(uint32 heal)
: m_heal(heal)
{
m_absorb = 0;
}
@@ -726,13 +726,12 @@ namespace Trinity
class GameObjectWithDbGUIDCheck
{
public:
GameObjectWithDbGUIDCheck(WorldObject const& obj, uint32 db_guid) : i_obj(obj), i_db_guid(db_guid) {}
GameObjectWithDbGUIDCheck(WorldObject const& /*obj*/, uint32 db_guid) : i_db_guid(db_guid) {}
bool operator()(GameObject const* go) const
{
return go->GetDBTableGUIDLow() == i_db_guid;
}
private:
WorldObject const& i_obj;
uint32 i_db_guid;
};
@@ -860,13 +859,12 @@ namespace Trinity
class CreatureWithDbGUIDCheck
{
public:
CreatureWithDbGUIDCheck(WorldObject const* obj, uint32 lowguid) : i_obj(obj), i_lowguid(lowguid) {}
CreatureWithDbGUIDCheck(WorldObject const* /*obj*/, uint32 lowguid) : i_lowguid(lowguid) {}
bool operator()(Creature* u)
{
return u->GetDBTableGUIDLow() == i_lowguid;
}
private:
WorldObject const* i_obj;
uint32 i_lowguid;
};
+1 -2
View File
@@ -49,7 +49,7 @@ class ObjectWorldLoader
{
public:
explicit ObjectWorldLoader(ObjectGridLoader& gloader)
: i_cell(gloader.i_cell), i_grid(gloader.i_grid), i_map(gloader.i_map), i_corpses (0)
: i_cell(gloader.i_cell), i_map(gloader.i_map), i_corpses (0)
{}
void Visit(CorpseMapType &m);
@@ -58,7 +58,6 @@ class ObjectWorldLoader
private:
Cell i_cell;
NGridType &i_grid;
Map* i_map;
public:
uint32 i_corpses;
+2 -2
View File
@@ -2381,9 +2381,9 @@ void Guild::SetBankTabText(uint8 tabId, std::string const& text)
// Private methods
void Guild::_CreateLogHolders()
{
m_eventLog = new LogHolder(m_id, sWorld->getIntConfig(CONFIG_GUILD_EVENT_LOG_COUNT));
m_eventLog = new LogHolder(sWorld->getIntConfig(CONFIG_GUILD_EVENT_LOG_COUNT));
for (uint8 tabId = 0; tabId <= GUILD_BANK_MAX_TABS; ++tabId)
m_bankEventLog[tabId] = new LogHolder(m_id, sWorld->getIntConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT));
m_bankEventLog[tabId] = new LogHolder(sWorld->getIntConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT));
}
void Guild::_CreateNewBankTab()
+1 -2
View File
@@ -444,7 +444,7 @@ private:
class LogHolder
{
public:
LogHolder(uint32 guildId, uint32 maxRecords) : m_guildId(guildId), m_maxRecords(maxRecords), m_nextGUID(uint32(GUILD_EVENT_LOG_GUID_UNDEFINED)) { }
LogHolder(uint32 maxRecords) : m_maxRecords(maxRecords), m_nextGUID(uint32(GUILD_EVENT_LOG_GUID_UNDEFINED)) { }
~LogHolder();
uint8 GetSize() const { return uint8(m_log.size()); }
@@ -460,7 +460,6 @@ private:
private:
GuildLog m_log;
uint32 m_guildId;
uint32 m_maxRecords;
uint32 m_nextGUID;
};
@@ -586,7 +586,6 @@ void AuraEffect::CalculateSpellMod()
{
m_spellmod = new SpellModifier(GetBase());
m_spellmod->op = SpellModOp(GetMiscValue());
ASSERT(m_spellmod->op < MAX_SPELLMOD);
m_spellmod->type = SpellModType(uint32(GetAuraType())); // SpellModType value == spell aura types
m_spellmod->spellId = GetId();
+4
View File
@@ -2849,11 +2849,15 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask)
// trigger linked auras remove/apply
/// @todo remove/cleanup this, as this table is not documented and people are doing stupid things with it
if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id + SPELL_LINK_HIT))
{
for (std::vector<int32>::const_iterator i = spellTriggered->begin(); i != spellTriggered->end(); ++i)
{
if (*i < 0)
unit->RemoveAurasDueToSpell(-(*i));
else
unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID());
}
}
}
void Spell::DoAllEffectOnTarget(GOTargetInfo* target)
@@ -158,8 +158,7 @@ public:
DialogueHelper(DialogueEntry const* dialogueArray) :
_dialogueArray(dialogueArray),
_currentEntry(NULL),
_actionTimer(0),
_isFirstSide(true)
_actionTimer(0)
{}
// The array MUST be terminated by {0, 0, 0, 0, 0}
@@ -237,7 +236,6 @@ private:
DialogueEntry const* _currentEntry;
uint32 _actionTimer;
bool _isFirstSide;
};
const DialogueEntry introDialogue[] =
@@ -882,8 +882,6 @@ class npc_halion_controller : public CreatureScript
InstanceScript* _instance;
SummonList _summons;
bool _corporealityCheck;
uint32 _twilightDamageTaken;
uint32 _materialDamageTaken;
uint8 _materialCorporealityValue;
@@ -419,8 +419,6 @@ class boss_anubarak_trial : public CreatureScript
uint64 _sphereGUID[6];
bool _intro;
bool _reachedPhase3;
uint32 _frostSphereTimer;
uint32 _berserkTimer;
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
@@ -579,7 +577,6 @@ class npc_nerubian_burrower : public CreatureScript
private:
uint32 _submergeTimer;
Phases _phase;
EventMap _events;
InstanceScript* _instance;
};
@@ -1135,7 +1135,6 @@ class boss_icehowl : public CreatureScript
bool _movementFinish;
bool _trampleCasted;
uint8 _stage;
Unit* _target;
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
@@ -845,7 +845,6 @@ public:
InstanceScript* instance;
EventMap events;
uint64 summonerGuid;
float distanceToShade;
bool startedBanishing;
bool switchToCombat;
};
@@ -186,7 +186,6 @@ class boss_nazan : public CreatureScript
uint32 Turn_Timer;
bool flight;
uint64 VazrudenGUID;
SpellInfo* liquid_fire;
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE