From 9579d0a3e717b918192a5dfab520ec1033dfe64c Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 21 Sep 2013 22:36:23 +0200 Subject: Scripts/ScarletEnclave: Fix uninitialized values in Highlord Darion Mograine Reset() has if checks on values that are initialized after them so it's required to initialize these fields in the constructor. Valgrind log: Conditional jump or move depends on uninitialised value(s) by 0x11CF472: HashMapHolder::Find(unsigned long) (ObjectAccessor.h:67) by 0x11CE36F: Creature* ObjectAccessor::GetObjectInWorld(unsigned long, Creature*) (ObjectAccessor.h:114) by 0x1257C13: Creature* ObjectAccessor::GetObjectInMap(unsigned long, Map*, Creature*) (ObjectAccessor.h:135) by 0x12E64F1: Map::GetCreature(unsigned long) (Map.cpp:2767) by 0x10AF4DE: Unit::GetCreature(WorldObject&, unsigned long) (Unit.cpp:13021) by 0x16F8F81: npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::Reset() (chapter5.cpp:386) by 0x16F8D36: npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::npc_highlord_darion_mograineAI(Creature*) (chapter5.cpp:314) by 0x16F8CD6: npc_highlord_darion_mograine::GetAI(Creature*) const (chapter5.cpp:307) by 0x132AF6C: ScriptMgr::GetCreatureAI(Creature*) (ScriptMgr.cpp:796) by 0x1441D45: FactorySelector::selectAI(Creature*) (CreatureAISelector.cpp:41) --- .../scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 382a0002065..ab1367ed684 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -311,6 +311,23 @@ public: { npc_highlord_darion_mograineAI(Creature* creature) : npc_escortAI(creature) { + uiTirionGUID = 0; + uiKorfaxGUID = 0; + uiMaxwellGUID = 0; + uiEligorGUID = 0; + uiRayneGUID = 0; + uiKoltiraGUID = 0; + uiOrbazGUID = 0; + uiThassarianGUID = 0; + uiLichKingGUID = 0; + + memset(uiDefenderGUID, 0, sizeof(uiDefenderGUID)); + memset(uiEarthshatterGUID, 0, sizeof(uiEarthshatterGUID)); + memset(uiAbominationGUID, 0, sizeof(uiAbominationGUID)); + memset(uiBehemothGUID, 0, sizeof(uiBehemothGUID)); + memset(uiGhoulGUID, 0, sizeof(uiGhoulGUID)); + memset(uiWarriorGUID, 0, sizeof(uiWarriorGUID)); + Reset(); } -- cgit v1.2.3