Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/game/Object/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6023,6 +6023,7 @@ void Player::UpdateUnderwaterState(Map* m, float x, float y, float z)
{
GridMapLiquidData liquid_status;
GridMapLiquidStatus res = m->GetTerrain()->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquid_status);
SetInWater(res & (LIQUID_MAP_IN_WATER | LIQUID_MAP_UNDER_WATER));
if (!res)
{
m_MirrorTimerFlags &= ~(UNDERWATER_INWATER | UNDERWATER_INLAVA | UNDERWATER_INSLIME | UNDERWATER_INDARKWATER);
Expand Down
13 changes: 13 additions & 0 deletions src/game/WorldHandlers/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
#include "BattleGround/BattleGroundMgr.h"
#include "OutdoorPvP/OutdoorPvP.h"
#include "VMapFactory.h"
#include "VMapManager2.h"
#include "MoveMap.h"
#include "GameEventMgr.h"
#include "PoolManager.h"
Expand Down Expand Up @@ -444,6 +445,18 @@ void World::SetInitialWorldSettings()
DetectDBCLang();
sObjectMgr.SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)

///- Populate vmap liquid type map from DBC data
if (VMAP::VMapManager2* vmmgr2 = dynamic_cast<VMAP::VMapManager2*>(VMAP::VMapFactory::createOrGetVMapManager()))
{
for (uint32 i = 0; i < sLiquidTypeStore.GetNumRows(); ++i)
{
if (LiquidTypeEntry const* entry = sLiquidTypeStore.LookupEntry(i))
{
vmmgr2->SetLiquidTypeMap(entry->ID, 1 << entry->Type);
}
}
}

StartupUI::Step("Loading Script Names...");
sScriptMgr.LoadScriptNames();

Expand Down
10 changes: 8 additions & 2 deletions src/game/vmap/VMapManager2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,16 @@ namespace VMAP
{
floor = info.ground_Z;
type = info.hitModel->GetLiquidType();
if (ReqLiquidType && !(type & ReqLiquidType))

if (ReqLiquidType)
{
return false;
UNORDERED_MAP<uint32, uint8>::const_iterator it = iLiquidTypeMap.find(type);
if (it != iLiquidTypeMap.end() && !(it->second & ReqLiquidType))
{
return false;
}
}

if (info.hitInstance->GetLiquidLevel(pos, info, level))
{
return true;
Expand Down
4 changes: 4 additions & 0 deletions src/game/vmap/VMapManager2.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ namespace VMAP
ModelFileMap iLoadedModelFiles; /**< Map of loaded model files. */
InstanceTreeMap iInstanceMapTrees; /**< Map of instance trees. */

UNORDERED_MAP<uint32, uint8> iLiquidTypeMap; /**< DBC entry ID to liquid type bitmask. */

/**
* @brief Internal method to load a map tile.
*
Expand Down Expand Up @@ -278,6 +280,8 @@ namespace VMAP
*/
bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float& level, float& floor, uint32& type) const override;

void SetLiquidTypeMap(uint32 entryId, uint8 bitmask) { iLiquidTypeMap[entryId] = bitmask; }

/**
* @brief Acquires a model instance.
*
Expand Down
Loading