Round QNH down, round magvar properly. Crew: round weight up.

parent f0d85f93
......@@ -129,7 +129,7 @@ var LandingPrompt = func() {
chat(text);
if(!_WOW){
settimer(func{
var landing_tons = int(getprop("/fdm/jsbsim/inertia/weight-lbs") * 0.001 * LB2KG);
var landing_tons = math.ceil(getprop("/fdm/jsbsim/inertia/weight-lbs") * 0.001 * LB2KG);
var weighttext = "Landing weight: " ~ landing_tons ~ " tons.";
if(landing_tons > 132){
weighttext = weighttext ~ " Guys, listen! We're too heavy!";
......
......@@ -78,7 +78,7 @@ var approx = func(val1, val2, tol) {
var CalcTakeoff = func() {
var takeoff_tons = int(getprop("/fdm/jsbsim/inertia/weight-lbs") * 0.001 * LB2KG);
var takeoff_tons = math.ceil(getprop("/fdm/jsbsim/inertia/weight-lbs") * 0.001 * LB2KG);
var air_degC = getprop("/fdm/jsbsim/atmosphere/T-degC");
if((takeoff_tons > 180) + (air_degC > 20.0)){
_alpha_v_to = 85.0;
......
......@@ -632,7 +632,7 @@ NPKIntegration = func(on) {
# @param memb Crew member: 0: pilot, 1: copilot.
# @param mmHg Pressure in mmHg.
SetQNH = func (memb, mmHg) {
mmHg = int(mmHg);
mmHg = math.round(mmHg, 1.0);
setprop("/fdm/jsbsim/fcs/NPK/instr/UVO[" ~ memb ~ "]/pot/P0-mmHg", mmHg);
setprop("/fdm/jsbsim/systems/instr/VM[" ~ memb ~ "]/pot/mmHg", mmHg);
}
......@@ -648,7 +648,7 @@ SetQNHAll = func (mmHg) {
# @brief Set magnetic variation.
# Set magnetic variation within 0.1 deg.
SetMagvar = func (magvar) {
setprop("/fdm/jsbsim/fcs/NPK/panel/PK/pot/variation-deg", 0.1 * int(10 * magvar));
setprop("/fdm/jsbsim/fcs/NPK/panel/PK/pot/variation-deg", math.round(magvar, 0.1));
}
# @brief Reset G meter.
......@@ -706,7 +706,7 @@ PrepareNPK = func () {
# @brief Prepare all instruments.
PrepareInstruments = func () {
QNH = int(getprop("/environment/metar/pressure-sea-level-inhg") * 25.4);
QNH = math.floor(getprop("/environment/metar/pressure-sea-level-inhg") * 25.4);
setprop("/sim/crew/orders/altimeter-mmHg", QNH);
SetQNHAll(QNH);
for(var ii = 0; ii < 2; ii += 1){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment