InLiquid converted to xyz_location

This commit is contained in:
Arthur Ice 2014-11-26 19:32:46 -08:00
parent 29573d7d19
commit 6cd614a05e
6 changed files with 119 additions and 118 deletions

View File

@ -2478,8 +2478,9 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp,
}
}
auto otherPosition = xyz_location(other->GetX(), other->GetY(), other->GetZ());
if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(other->GetX(), other->GetY(), other->GetZ())) {
if(!zone->watermap->InLiquid(otherPosition)) {
return;
}
}

View File

@ -4595,13 +4595,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
safe_delete(outapp);
}
if(zone->watermap)
{
if(zone->watermap->InLiquid(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))
{
CheckIncreaseSkill(SkillSwimming, nullptr, -17);
}
}
if(zone->watermap && zone->watermap->InLiquid(m_Position))
CheckIncreaseSkill(SkillSwimming, nullptr, -17);
return;
}

View File

@ -303,8 +303,9 @@ Mob *HateList::GetTop(Mob *center)
continue;
}
auto hateEntryPosition = xyz_location(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ());
if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) {
if(!zone->watermap->InLiquid(hateEntryPosition)) {
skipped_count++;
++iterator;
continue;
@ -428,8 +429,9 @@ Mob *HateList::GetTop(Mob *center)
while(iterator != list.end())
{
tHateEntry *cur = (*iterator);
auto hateEntryPosition = xyz_location(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ());
if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) {
if(!zone->watermap->InLiquid(hateEntryPosition)) {
skipped_count++;
++iterator;
continue;

View File

@ -1372,7 +1372,8 @@ void Mob::AI_Process() {
//we cannot reach our target...
//underwater stuff only works with water maps in the zone!
if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(target->GetX(), target->GetY(), target->GetZ())) {
auto targetPosition = xyz_location(target->GetX(), target->GetY(), target->GetZ());
if(!zone->watermap->InLiquid(targetPosition)) {
Mob *tar = hate_list.GetTop(this);
if(tar == target) {
WipeHateList();

View File

@ -1197,12 +1197,14 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To)
if (zone->watermap)
{
if (zone->watermap->InLiquid(From.x, From.y, From.z) || zone->watermap->InLiquid(To.x, To.y, To.z))
auto from = xyz_location(From.x, From.y, From.z);
auto to = xyz_location(To.x, To.y, To.z);
if (zone->watermap->InLiquid(from) || zone->watermap->InLiquid(to))
{
break;
}
if (zone->watermap->InLiquid(TestPoint.x, TestPoint.y, NewZ))
auto testPointNewZ = xyz_location(TestPoint.x, TestPoint.y, NewZ);
if (zone->watermap->InLiquid(testPointNewZ))
{
Map::Vertex TestPointWater(TestPoint.x, TestPoint.y, NewZ - 0.5f);
Map::Vertex TestPointWaterDest = TestPointWater;

View File

@ -29,7 +29,7 @@ public:
virtual bool InWater(const xyz_location& location) const { return false; }
virtual bool InVWater(const xyz_location& location) const { return false; }
virtual bool InLava(const xyz_location& location) const { return false; }
virtual bool InLiquid(float y, float x, float z) const { return false; }
virtual bool InLiquid(const xyz_location& location) const { return false; }
protected:
virtual bool Load(FILE *fp) { return false; }