From 2a4b8f2cb0c4d89f560255df0f35a6d43b0ea764 Mon Sep 17 00:00:00 2001 From: Xfurry Date: Fri, 6 Jul 2012 14:44:47 +0200 Subject: [PATCH] [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 --- src/game/ObjectMgr.cpp | 17 +++++++++++++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index c86c1282a..4d1d91b48 100755 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -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(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; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c57542a73..29a78e7ec 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12060" + #define REVISION_NR "12061" #endif // __REVISION_NR_H__