Core: Fix many "errors"/warnings and coding style (3)

Game

Errors were found using Cppcheck, open-source static analysis tool
This commit is contained in:
Nay
2012-08-30 22:44:33 +01:00
parent abbb896cfb
commit e3d9768a50
28 changed files with 72 additions and 105 deletions
@@ -79,6 +79,7 @@ SmartScript::SmartScript()
{
go = NULL;
me = NULL;
trigger = NULL;
mEventPhase = 0;
mPathId = 0;
mTargetStorage = new ObjectListMap();
@@ -92,6 +93,7 @@ SmartScript::SmartScript()
meOrigGUID = 0;
goOrigGUID = 0;
mLastInvoker = 0;
mScriptType = SMART_SCRIPT_TYPE_CREATURE;
}
SmartScript::~SmartScript()
@@ -1117,10 +1119,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_SUMMON_CREATURE:
{
float x, y, z, o;
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
float x, y, z, o;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
(*itr)->GetPosition(x, y, z, o);
@@ -1149,10 +1151,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!GetBaseObject())
break;
float x, y, z, o;
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
float x, y, z, o;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (!IsUnit(*itr))
@@ -913,7 +913,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return true;
}
bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
/*bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id) // unused
{
bool error = false;
uint32 entry = 0;
@@ -938,4 +938,4 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
return false;
}
return true;
}
}*/
@@ -1215,16 +1215,9 @@ enum SmartCastFlags
// one line in DB is one event
struct SmartScriptHolder
{
SmartScriptHolder()
{
timer = 0;
active = false;
runOnce = false;
link = 0;
entryOrGuid = 0;
event_id = 0;
enableTimed = false;
}
SmartScriptHolder() : timer(0), active(false), runOnce(false), link(0), entryOrGuid(0),
event_id(0), enableTimed(false), source_type(SMART_SCRIPT_TYPE_CREATURE) {}
int32 entryOrGuid;
SmartScriptType source_type;
uint32 event_id;
@@ -1436,7 +1429,7 @@ class SmartAIMgr
return true;
}
bool IsTextValid(SmartScriptHolder const& e, uint32 id);
//bool IsTextValid(SmartScriptHolder const& e, uint32 id);
};
#define sSmartScriptMgr ACE_Singleton<SmartAIMgr, ACE_Null_Mutex>::instance()