aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/SmartScripts
diff options
context:
space:
mode:
authorNay <dnpd.dd@gmail.com>2012-08-30 22:44:33 +0100
committerNay <dnpd.dd@gmail.com>2012-08-30 22:44:33 +0100
commite3d9768a50a3b2b700d65e0cc96e697a5c9d22dc (patch)
tree221f2bc4bd2745ab9bcc7389523f4a43d8ac8b11 /src/server/game/AI/SmartScripts
parentabbb896cfb73017cf1c313d597984a9ce0a9dcab (diff)
Core: Fix many "errors"/warnings and coding style (3)
Game Errors were found using Cppcheck, open-source static analysis tool
Diffstat (limited to 'src/server/game/AI/SmartScripts')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp6
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp4
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h15
3 files changed, 10 insertions, 15 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 6e5a34e8c33..69ecb1ef581 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -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))
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 3b69408354e..ef5c7511124 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -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;
-}
+}*/
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 05965d8ffa0..f1747734a29 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -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()