@@ -253,70 +253,8 @@ namespace VMAP
253253 return VMAP_INVALID_HEIGHT_VALUE;
254254 }
255255
256- bool VMapMgr2::GetAreaInfo (uint32 mapId, float x, float y, float & z, uint32& flags, int32& adtId, int32& rootId, int32& groupId ) const
256+ bool VMapMgr2::GetAreaAndLiquidData (uint32 mapId, float x, float y, float z, Optional<uint8> reqLiquidType, AreaAndLiquidData& data ) const
257257 {
258- #if defined(ENABLE_VMAP_CHECKS)
259- if (!IsVMAPDisabledForPtr (mapId, VMAP_DISABLE_AREAFLAG))
260- #endif
261- {
262- InstanceTreeMap::const_iterator instanceTree = GetMapTree (mapId);
263- if (instanceTree != iInstanceMapTrees.end ())
264- {
265- Vector3 pos = convertPositionToInternalRep (x, y, z);
266- bool result = instanceTree->second ->GetAreaInfo (pos, flags, adtId, rootId, groupId);
267- // z is not touched by convertPositionToInternalRep(), so just copy
268- z = pos.z ;
269- return result;
270- }
271- }
272-
273- return false ;
274- }
275-
276- bool VMapMgr2::GetLiquidLevel (uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float & level, float & floor, uint32& type, uint32& mogpFlags) const
277- {
278- #if defined(ENABLE_VMAP_CHECKS)
279- if (!IsVMAPDisabledForPtr (mapId, VMAP_DISABLE_LIQUIDSTATUS))
280- #endif
281- {
282- InstanceTreeMap::const_iterator instanceTree = GetMapTree (mapId);
283- if (instanceTree != iInstanceMapTrees.end ())
284- {
285- LocationInfo info;
286- Vector3 pos = convertPositionToInternalRep (x, y, z);
287- if (instanceTree->second ->GetLocationInfo (pos, info))
288- {
289- floor = info.ground_Z ;
290- ASSERT (floor < std::numeric_limits<float >::max ());
291- type = info.hitModel ->GetLiquidType (); // entry from LiquidType.dbc
292- mogpFlags = info.hitModel ->GetMogpFlags ();
293- if (reqLiquidType && !(GetLiquidFlagsPtr (type) & reqLiquidType))
294- {
295- return false ;
296- }
297- if (info.hitInstance ->GetLiquidLevel (pos, info, level))
298- {
299- return true ;
300- }
301- }
302- }
303- }
304-
305- return false ;
306- }
307-
308- void VMapMgr2::GetAreaAndLiquidData (uint32 mapId, float x, float y, float z, uint8 reqLiquidType, AreaAndLiquidData& data) const
309- {
310- if (IsVMAPDisabledForPtr (mapId, VMAP_DISABLE_LIQUIDSTATUS))
311- {
312- data.floorZ = z;
313- int32 adtId, rootId, groupId;
314- uint32 flags;
315- if (GetAreaInfo (mapId, x, y, data.floorZ , flags, adtId, rootId, groupId))
316- data.areaInfo .emplace (adtId, rootId, groupId, flags);
317- return ;
318- }
319-
320258 InstanceTreeMap::const_iterator instanceTree = GetMapTree (mapId);
321259 if (instanceTree != iInstanceMapTrees.end ())
322260 {
@@ -325,16 +263,22 @@ namespace VMAP
325263 if (instanceTree->second ->GetLocationInfo (pos, info))
326264 {
327265 data.floorZ = info.ground_Z ;
328- uint32 liquidType = info.hitModel ->GetLiquidType ();
329- float liquidLevel;
330- if (!reqLiquidType || (GetLiquidFlagsPtr (liquidType) & reqLiquidType))
331- if (info.hitInstance ->GetLiquidLevel (pos, info, liquidLevel))
332- data.liquidInfo .emplace (liquidType, liquidLevel);
266+ if (!IsVMAPDisabledForPtr (mapId, VMAP_DISABLE_LIQUIDSTATUS))
267+ {
268+ uint32 liquidType = info.hitModel ->GetLiquidType (); // entry from LiquidType.dbc
269+ float liquidLevel;
270+ if (!reqLiquidType || (GetLiquidFlagsPtr (liquidType) & *reqLiquidType))
271+ if (info.hitInstance ->GetLiquidLevel (pos, info, liquidLevel))
272+ data.liquidInfo .emplace (liquidType, liquidLevel);
273+ }
333274
334275 if (!IsVMAPDisabledForPtr (mapId, VMAP_DISABLE_AREAFLAG))
335- data.areaInfo .emplace (info.hitInstance ->adtId , info.rootId , info.hitModel ->GetWmoID (), info.hitModel ->GetMogpFlags ());
276+ data.areaInfo .emplace (info.hitModel ->GetWmoID (), info.hitInstance ->adtId , info.rootId , info.hitModel ->GetMogpFlags (), info.hitInstance ->ID );
277+ return true ;
336278 }
337279 }
280+
281+ return false ;
338282 }
339283
340284 WorldModel* VMapMgr2::acquireModelInstance (const std::string& basepath, const std::string& filename, uint32 flags/* Only used when creating the model */ )
0 commit comments