Allow validated vertical approaches to elevated flight landings
clang PCH / build (push) Canceled after 0s
GCC PCH / build (push) Canceled after 0s

This commit is contained in:
Nico committed 2026-11-02 08:32:21 +01:00
1 parent 2778cf9bdd
commit 3056063f12
9 files changed
+344 -11

No files matched your search

+11 -3
View File
@@ -208,9 +208,12 @@ Surface ClientlessFlightMgr::Sample(Player * player, Record & record, float x, f
float water = map->GetWaterLevel(player->GetPhaseShift(), x, y);
if (std::isfinite(water) && water > ground) ground = water;
float ceiling = map->GetTerrain()->GetMaxHeight(player->GetPhaseShift(), map->GetId(), x, y);
float terrainFloor=map->GetTerrain()->GetStaticHeight(player->GetPhaseShift(),map->GetId(),x,y,MAX_HEIGHT,false,MAX_HEIGHT);
if(std::isfinite(water) && water>terrainFloor)terrainFloor=water;
return
{
ground, ceiling, std::isfinite(ground) && std::isfinite(ceiling) && ground > INVALID_HEIGHT + 1 && ceiling > ground + 5
ground, ceiling, std::isfinite(ground) && std::isfinite(ceiling) && ground > INVALID_HEIGHT + 1 && ceiling > ground + 5,
std::isfinite(terrainFloor) && terrainFloor>INVALID_HEIGHT+1?terrainFloor:std::numeric_limits<float>::infinity()
};
}
@@ -713,13 +716,18 @@ bool ClientlessFlightMgr::Advance(Player * player, Record & record, bool handoff
return false;
}
record.Published->Points.push_back(next.Next);
record.Published->UnderOverhang.push_back(next.UnderOverhang);
record.SegmentUnderOverhang=next.UnderOverhang;
record.Moving = true;
record.SegmentElapsed = 0;
++ record.Status.Segments;
record.Status.Avoidances += next.Avoiding ? 1 : 0;
if (handoff) ++record.Status.Handoffs;
bool const vertical=Horizontal(current,next.Next)<1.0f && std::fabs(next.Next.Z-current.Z)>1.0f;
record.Status.Detail = next.Avoiding ? "obstacle avoidance" : next.Landing && vertical ? "vertical landing fallback" :
record.Status.Detail = next.UnderOverhang ? "elevated approach lateral escape" :
record.Memory.Elevated==Memory::ElevatedPhase::Climb ? "elevated approach vertical climb" :
record.Memory.Elevated==Memory::ElevatedPhase::Cross ? "elevated approach above platform" :
next.Avoiding ? "obstacle avoidance" : next.Landing && vertical ? "vertical landing fallback" :
next.Landing ? "landing approach" : vertical && next.Next.Z>current.Z ? "vertical takeoff fallback" :
vertical ? "vertical descent fallback" : next.Next.Z < current.Z - 0.25f ? "diagonal descent" :
next.Next.Z > current.Z + 0.25f ? "diagonal climb" : "terrain-smoothed cruise";
@@ -818,7 +826,7 @@ void ClientlessFlightMgr::Update(uint32 diff)
return Sample(player, record, x, y);
};
// Recheck the remaining corridor as moving GO geometry changes.
if (! Corridor(PointOf(* player), PointOf(record.Segment), PointOf(record.Returning ? record.Start : record.Status.Landing), record.Settings, sample, ray, true))
if (! Corridor(PointOf(* player), PointOf(record.Segment), PointOf(record.Returning ? record.Start : record.Status.Landing), record.Settings, sample, ray, true, record.SegmentUnderOverhang && !record.Returning))
{
player->StopMoving();
record.Moving = false;