[11320] Check if Creature::GetRespawnCoord() function returns valid map coordinates. Invalid data might cause crashes with movement generators.

Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
Ambal 2011-04-06 10:53:43 +03:00
parent 0f12e9cc3e
commit f46f4e1b87
2 changed files with 17 additions and 10 deletions

View file

@ -2120,10 +2120,9 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float*
*ori = data->orientation; *ori = data->orientation;
if (dist) if (dist)
*dist = GetRespawnRadius(); *dist = GetRespawnRadius();
return;
} }
else
{
float orient; float orient;
GetSummonPoint(x, y, z, orient); GetSummonPoint(x, y, z, orient);
@ -2132,6 +2131,14 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float*
*ori = orient; *ori = orient;
if (dist) if (dist)
*dist = GetRespawnRadius(); *dist = GetRespawnRadius();
}
//lets check if our creatures have valid spawn coordinates
if(!MaNGOS::IsValidMapCoord(x, y, z))
{
sLog.outError("Creature with invalid respawn coordinates: mapid = %u, guid = %u, x = %f, y = %f, z = %f", GetMapId(), GetGUIDLow(), x, y, z);
MANGOS_ASSERT(false);
}
} }
void Creature::AllLootRemovedFromCorpse() void Creature::AllLootRemovedFromCorpse()

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11319" #define REVISION_NR "11320"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__