[svn] Check creature combat reach when loading db. This should fix the bug that finding random contact point causes crash.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-11-01 16:53:16 -05:00
parent d292b85d38
commit 37d0fdd0cd
4 changed files with 20 additions and 8 deletions

View File

@@ -958,6 +958,20 @@ void ObjectMgr::LoadCreatureModelInfo()
sLog.outString( ">> Loaded %u creature model based info", sCreatureModelStorage.RecordCount );
sLog.outString();
// check if combat_reach is valid
for(uint32 i = 1; i < sCreatureModelStorage.MaxEntry; ++i)
{
CreatureModelInfo const* mInfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(i);
if(!mInfo)
continue;
if(mInfo->combat_reach < 0.5f)
{
sLog.outErrorDb("Creature model (Entry: %u) has invalid combat reach (%f), setting it to 0.5", mInfo->modelid, mInfo->combat_reach);
const_cast<CreatureModelInfo*>(mInfo)->combat_reach = 0.5f;
}
}
}
void ObjectMgr::LoadCreatures()