Skip to content

Commit

Permalink
Fix LandingDir for non-AirportBound aircraft
Browse files Browse the repository at this point in the history
  • Loading branch information
Starkku committed Mar 17, 2024
1 parent 196a4b3 commit dba2ec3
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/Ext/Aircraft/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ DirType AircraftExt::GetLandingDir(AircraftClass* pThis, BuildingClass* pDock)
if (auto pOwner = pThis->SpawnOwner)
return pOwner->PrimaryFacing.Current().GetDir();

bool isAirportBound = true;

if (pDock || pThis->HasAnyLink())
{
auto pLink = pThis->GetNthLink(0);
Expand All @@ -89,18 +87,12 @@ DirType AircraftExt::GetLandingDir(AircraftClass* pThis, BuildingClass* pDock)
else if (!pThis->Type->AirportBound)
return pLink->PrimaryFacing.Current().GetDir();
}
else if (!pThis->Type->AirportBound)
{
isAirportBound = false;
}

int landingDir = TechnoTypeExt::ExtMap.Find(pThis->GetTechnoType())->LandingDir.Get((int)poseDir);

if (isAirportBound)
return static_cast<DirType>(Math::clamp(landingDir, 0, 255));
else if (landingDir < 0)
if (!pThis->Type->AirportBound && landingDir < 0)
return pThis->PrimaryFacing.Current().GetDir();

return poseDir;
return static_cast<DirType>(Math::clamp(landingDir, 0, 255));
}

0 comments on commit dba2ec3

Please sign in to comment.