Scripts/Serpentshrine Cavern: Fixed crashes caused by uninitialized variables, patch by PuniCZ

Closes #4988
Closes #5645
This commit is contained in:
Shauren
2012-03-11 15:03:29 +01:00
parent b1a8570a30
commit 3cf8b9a15a
@@ -608,24 +608,21 @@ public:
VashjGUID = 0; 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]; x = ElementWPPos[i][0];
y = ElementWPPos[i][1]; y = ElementWPPos[i][1];
z = ElementWPPos[i][2]; 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) if (instance)
VashjGUID = instance->GetData64(DATA_LADYVASHJ); VashjGUID = instance->GetData64(DATA_LADYVASHJ);
} }