@@ -1481,7 +1481,7 @@ static fixed CalculateHabitability(SystemBody *sbody)
14811481 // Surface gravity - mean at 7.5 with standard deviation of 7.5, so slightly less than Earth gravity is a
14821482 // pleasure to work in, zero gravity is still habitable, but has a penalty, while heavier than Earth gravity
14831483 // gets progressively worse. Multiply the result a small amount so that Earth itself is back up to 1.0
1484- const fixed gravity = fixed::FromDouble ( sbody->CalcSurfaceGravity () );
1484+ const fixed gravity = sbody->CalcSurfaceGravityAsFixed ( );
14851485 habitability *= FalloffFunction (gravity, fixed (15 , 2 ), fixed (15 , 2 )) * fixed (106 , 100 );
14861486
14871487 // If the entire planet is covered in ice (ice coverage = 1) then that's hugely inconvenient for industry and
@@ -1502,20 +1502,21 @@ static fixed CalculateHabitability(SystemBody *sbody)
15021502 // too heavily. Fundamentally, if there is very low air pressure, then the temperature and composition don't matter.
15031503 // So first check air pressure, and if it's below a threshold then skip over the other two.
15041504
1505- // Atmospheric pressure. 1.0 is Earth atmosphere density, so that's our baseline, with medium fall-off.
1506- const fixed pressure = fixed::FromDouble (sbody->GetAtmSurfacePressure ());
1507- habitability *= FalloffFunction (pressure, fixed (1 , 1 ), fixed (9 , 10 ));
1505+ // For atmospheric pressure, we'll use the gas density, since it's already in fixed point and is good enough for this
1506+ // rough habitability calculation. 1.225 is Earth atmosphere density, so that's our baseline, with medium fall-off.
1507+ const fixed density = sbody->GetVolatileGasAsFixed ();
1508+ habitability *= FalloffFunction (density, fixed (1225 , 1000 ), fixed (11 , 10 ));
15081509
1509- if (pressure > 0.5 ) {
1510+ if (density > fixed ( 6 , 10 ) ) {
15101511 // Temperature is in Kelvin. Average temperature on Earth's service is 15 Celsius, so 273+15 is our mean.
15111512 // Humans live at extremes on Earth, plus we're dealing with the future, so 50 for a standard deviation seems
15121513 // reasonable, though narrow in astrophysical terms
1513- const fixed temperature = fixed::FromDouble (sbody->GetAverageTemp ());
1514+ const fixed temperature = fixed (sbody->GetAverageTemp (), 1 );
15141515 habitability *= FalloffFunction (temperature, fixed (288 , 1 ), fixed (50 , 1 ));
15151516
15161517 // Breathable air is super convenient, while air that actively kills you is even worse than a vacuum. So let's heavily
15171518 // favour oxidising atmospheres over reducing onces.
1518- const fixed air_type = fixed::FromDouble ( sbody->GetAtmosOxidizing () );
1519+ const fixed air_type = sbody->GetAtmosOxidizingAsFixed ( );
15191520 habitability *= FalloffFunction (air_type, fixed (1 , 1 ), fixed (3 , 10 ));
15201521 }
15211522
0 commit comments