[7731] Some code cleanups, warrning fixes.

This commit is contained in:
VladimirMangos 2009-04-29 03:44:57 +04:00
parent 8144f30199
commit 512c015dc2
30 changed files with 128 additions and 151 deletions

View file

@ -65,7 +65,7 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
}
//EventMap had events but they were not added because they must be for instance
if (CreatureEventAIList.empty())
sLog.outError("CreatureEventAI: CreatureId has events but no events added to list because of instance flags.", m_creature->GetEntry());
sLog.outError("CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", m_creature->GetEntry());
}
else
sLog.outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry());
@ -105,34 +105,10 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
if (pHolder.Event.event_chance <= rnd % 100)
return false;
union
{
uint32 param1;
int32 param1_s;
};
union
{
uint32 param2;
int32 param2_s;
};
union
{
uint32 param3;
int32 param3_s;
};
union
{
uint32 param4;
int32 param4_s;
};
param1 = pHolder.Event.event_param1;
param2 = pHolder.Event.event_param2;
param3 = pHolder.Event.event_param3;
param4 = pHolder.Event.event_param4;
uint32 param1 = pHolder.Event.event_param1;
uint32 param2 = pHolder.Event.event_param2;
uint32 param3 = pHolder.Event.event_param3;
uint32 param4 = pHolder.Event.event_param4;
//Check event conditions based on the event type, also reset events
switch (pHolder.Event.event_type)
@ -519,13 +495,12 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u
if (temp)
{
Unit* target = NULL;
Unit* owner = NULL;
if (pActionInvoker)
{
if (pActionInvoker->GetTypeId() == TYPEID_PLAYER)
target = pActionInvoker;
else if (owner = pActionInvoker->GetOwner())
else if (Unit* owner = pActionInvoker->GetOwner())
{
if (owner->GetTypeId() == TYPEID_PLAYER)
target = owner;
@ -534,13 +509,9 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u
else if (target = m_creature->getVictim())
{
if (target->GetTypeId() != TYPEID_PLAYER)
{
if (owner = target->GetOwner())
{
if (Unit* owner = target->GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER)
target = owner;
}
}
}
DoScriptText(temp, m_creature, target);