@@ -233,63 +233,8 @@ namespace VMAP
233233 return VMAP_INVALID_HEIGHT_VALUE;
234234 }
235235
236- bool VMapManager2::getAreaInfo (uint32 mapId, float x, float y, float & z, uint32& flags, int32& adtId, int32& rootId, int32& groupId ) const
236+ bool VMapManager2::getAreaAndLiquidData ( unsigned int mapId, float x, float y, float z, Optional<uint8> reqLiquidType, AreaAndLiquidData& data ) const
237237 {
238- if (!IsVMAPDisabledForPtr (mapId, VMAP_DISABLE_AREAFLAG))
239- {
240- InstanceTreeMap::const_iterator instanceTree = GetMapTree (mapId);
241- if (instanceTree != iInstanceMapTrees.end ())
242- {
243- Vector3 pos = convertPositionToInternalRep (x, y, z);
244- bool result = instanceTree->second ->getAreaInfo (pos, flags, adtId, rootId, groupId);
245- // z is not touched by convertPositionToInternalRep(), so just copy
246- z = pos.z ;
247- return result;
248- }
249- }
250-
251- return false ;
252- }
253-
254- bool VMapManager2::GetLiquidLevel (uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float & level, float & floor, uint32& type, uint32& mogpFlags) const
255- {
256- if (!IsVMAPDisabledForPtr (mapId, VMAP_DISABLE_LIQUIDSTATUS))
257- {
258- InstanceTreeMap::const_iterator instanceTree = GetMapTree (mapId);
259- if (instanceTree != iInstanceMapTrees.end ())
260- {
261- LocationInfo info;
262- Vector3 pos = convertPositionToInternalRep (x, y, z);
263- if (instanceTree->second ->GetLocationInfo (pos, info))
264- {
265- floor = info.ground_Z ;
266- ASSERT (floor < std::numeric_limits<float >::max ());
267- ASSERT (info.hitModel );
268- type = info.hitModel ->GetLiquidType (); // entry from LiquidType.dbc
269- mogpFlags = info.hitModel ->GetMogpFlags ();
270- if (reqLiquidType && !(GetLiquidFlagsPtr (type) & reqLiquidType))
271- return false ;
272- ASSERT (info.hitInstance );
273- if (info.hitInstance ->GetLiquidLevel (pos, info, level))
274- return true ;
275- }
276- }
277- }
278-
279- return false ;
280- }
281-
282- void VMapManager2::getAreaAndLiquidData (unsigned int mapId, float x, float y, float z, uint8 reqLiquidType, AreaAndLiquidData& data) const
283- {
284- if (IsVMAPDisabledForPtr (mapId, VMAP_DISABLE_LIQUIDSTATUS))
285- {
286- data.floorZ = z;
287- int32 adtId, rootId, groupId;
288- uint32 flags;
289- if (getAreaInfo (mapId, x, y, data.floorZ , flags, adtId, rootId, groupId))
290- data.areaInfo .emplace (adtId, rootId, groupId, flags);
291- return ;
292- }
293238 InstanceTreeMap::const_iterator instanceTree = GetMapTree (mapId);
294239 if (instanceTree != iInstanceMapTrees.end ())
295240 {
@@ -300,16 +245,23 @@ namespace VMAP
300245 ASSERT (info.hitModel );
301246 ASSERT (info.hitInstance );
302247 data.floorZ = info.ground_Z ;
303- uint32 liquidType = info.hitModel ->GetLiquidType ();
304- float liquidLevel;
305- if (!reqLiquidType || (GetLiquidFlagsPtr (liquidType) & reqLiquidType))
306- if (info.hitInstance ->GetLiquidLevel (pos, info, liquidLevel))
307- data.liquidInfo .emplace (liquidType, liquidLevel);
248+ if (!IsVMAPDisabledForPtr (mapId, VMAP_DISABLE_LIQUIDSTATUS))
249+ {
250+ uint32 liquidType = info.hitModel ->GetLiquidType (); // entry from LiquidType.dbc
251+ float liquidLevel;
252+ if (!reqLiquidType || (GetLiquidFlagsPtr (liquidType) & *reqLiquidType))
253+ if (info.hitInstance ->GetLiquidLevel (pos, info, liquidLevel))
254+ data.liquidInfo .emplace (liquidType, liquidLevel);
255+ }
308256
309257 if (!IsVMAPDisabledForPtr (mapId, VMAP_DISABLE_AREAFLAG))
310- data.areaInfo .emplace (info.hitInstance ->adtId , info.rootId , info.hitModel ->GetWmoID (), info.hitModel ->GetMogpFlags ());
258+ data.areaInfo .emplace (info.hitModel ->GetWmoID (), info.hitInstance ->adtId , info.rootId , info.hitModel ->GetMogpFlags (), info.hitInstance ->ID );
259+
260+ return true ;
311261 }
312262 }
263+
264+ return false ;
313265 }
314266
315267 WorldModel* VMapManager2::acquireModelInstance (const std::string& basepath, const std::string& filename, uint32 flags/* Only used when creating the model */ )
0 commit comments