Skip to content

Commit

Permalink
Fix density display
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtribick committed Nov 14, 2023
1 parent 2667af1 commit f11c518
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/celestia/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,11 @@ displayPlanetInfo(Overlay& overlay,
if (float density = body.getDensity(); density > 0)
{
if (hudSettings.measurementSystem == MeasurementSystem::Imperial)
overlay.printf(_("Density: %.2f x 1000 lb/ft^3\n"), density / (float) OneLbPerFt3InKgPerM3 / 1000.0f);
overlay.print(_("Density: {} lb/ft³\n"),
FormattedNumber(density / static_cast<float>(OneLbPerFt3InKgPerM3), 4, FormattedNumber::SignificantDigits | FormattedNumber::GroupThousands));
else
overlay.printf(_("Density: %.2f x 1000 kg/m^3\n"), density / 1000.0f);
overlay.print(_("Density: {} kg/m³\n"),
FormattedNumber(density, 4, FormattedNumber::SignificantDigits | FormattedNumber::GroupThousands));
}

float planetTemp = body.getTemperature(t);
Expand Down

0 comments on commit f11c518

Please sign in to comment.