From 3cf8b9a15afee5e65b368721a74b4a942c027134 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 11 Mar 2012 15:03:29 +0100 Subject: Scripts/Serpentshrine Cavern: Fixed crashes caused by uninitialized variables, patch by PuniCZ Closes #4988 Closes #5645 --- .../SerpentShrine/boss_lady_vashj.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index 2db259744df..6de4c1c60ca 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -608,24 +608,21 @@ public: VashjGUID = 0; - for (int i = 0; i<8; ++i)//search for nearest waypoint (up on stairs) + x = ElementWPPos[0][0]; + y = ElementWPPos[0][1]; + z = ElementWPPos[0][2]; + + //search for nearest waypoint (up on stairs) + for (uint32 i = 1; i < 8; ++i) { - if (!x || !y || !z) + if (me->GetDistance(ElementWPPos[i][0], ElementWPPos[i][1], ElementWPPos[i][2]) < me->GetDistance(x, y, z)) { x = ElementWPPos[i][0]; y = ElementWPPos[i][1]; z = ElementWPPos[i][2]; } - else - { - if (me->GetDistance(ElementWPPos[i][0], ElementWPPos[i][1], ElementWPPos[i][2]) < me->GetDistance(x, y, z)) - { - x = ElementWPPos[i][0]; - y = ElementWPPos[i][1]; - z = ElementWPPos[i][2]; - } - } } + if (instance) VashjGUID = instance->GetData64(DATA_LADYVASHJ); } -- cgit v1.2.3