[12061] Assert correct loading of GO_TYPE_CAPTURE_POINT

This will assert controlled behaviour when loading a `gameobject_template` entry of type Capture Point with bad data
Patch improved by stfx

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Xfurry 2012-07-06 14:44:47 +02:00 committed by Schmoozerd
parent 5a0f668515
commit 2a4b8f2cb0
2 changed files with 18 additions and 1 deletions

View file

@ -5937,6 +5937,18 @@ inline void CheckGOConsumable(GameObjectInfo const* goInfo,uint32 dataN,uint32 N
goInfo->id,goInfo->type,N,dataN);
}
inline void CheckAndFixGOCaptureMinTime(GameObjectInfo const* goInfo, uint32 const& dataN, uint32 N)
{
if (dataN > 0)
return;
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) has data%d=%u but minTime field value must be > 0.",
goInfo->id, goInfo->type, N, dataN);
// prevent division through 0 exception
const_cast<uint32&>(dataN) = 1;
}
void ObjectMgr::LoadGameobjectInfo()
{
SQLGameObjectLoader loader;
@ -6099,6 +6111,11 @@ void ObjectMgr::LoadGameobjectInfo()
CheckGONoDamageImmuneId(goInfo,goInfo->flagdrop.noDamageImmune,3);
break;
}
case GAMEOBJECT_TYPE_CAPTURE_POINT: //29
{
CheckAndFixGOCaptureMinTime(goInfo, goInfo->capturePoint.minTime, 16);
break;
}
case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
CheckAndFixGOChairHeightId(goInfo,goInfo->barberChair.chairheight,0);
break;