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,15 +608,12 @@ 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];
if (!x || !y || !z) z = ElementWPPos[0][2];
{
x = ElementWPPos[i][0]; //search for nearest waypoint (up on stairs)
y = ElementWPPos[i][1]; for (uint32 i = 1; i < 8; ++i)
z = ElementWPPos[i][2];
}
else
{ {
if (me->GetDistance(ElementWPPos[i][0], ElementWPPos[i][1], ElementWPPos[i][2]) < me->GetDistance(x, y, z)) if (me->GetDistance(ElementWPPos[i][0], ElementWPPos[i][1], ElementWPPos[i][2]) < me->GetDistance(x, y, z))
{ {
@@ -625,7 +622,7 @@ public:
z = ElementWPPos[i][2]; z = ElementWPPos[i][2];
} }
} }
}
if (instance) if (instance)
VashjGUID = instance->GetData64(DATA_LADYVASHJ); VashjGUID = instance->GetData64(DATA_LADYVASHJ);
} }