]> git.mxchange.org Git - flightgear.git/commitdiff
- "almost zero" is zero
authormfranz <mfranz>
Tue, 1 Aug 2006 21:43:13 +0000 (21:43 +0000)
committermfranz <mfranz>
Tue, 1 Aug 2006 21:43:13 +0000 (21:43 +0000)
- improve/add <format> warning

src/Instrumentation/HUD/HUD_label.cxx
src/Instrumentation/HUD/HUD_tape.cxx

index 16a2348738d00ac9b708650e886bb8d64c7d7f30..eb7d979f20402aa2f721aad8fb3399e879f076b7 100644 (file)
@@ -69,7 +69,8 @@ HUD::Label::Label(HUD *hud, const SGPropertyNode *n, float x, float y) :
 
     _mode = check_format(_format.c_str());
     if (_mode == INVALID) {
-        SG_LOG(SG_INPUT, SG_ALERT, "HUD: invalid format '" << _format.c_str() << '\'');
+        SG_LOG(SG_INPUT, SG_ALERT, "HUD: invalid format '" << _format.c_str()
+                << "' in <label> '" << _name << '\'');
         _format = "INVALID";
         _mode = NONE;
     }
index 9b4609384b0522ba4fb2d1f03523772c0c9f8373..af7add2a20a11dee87713a237e8a9dbf6c55c0e9 100644 (file)
@@ -53,6 +53,8 @@ HUD::Tape::Tape(HUD *hud, const SGPropertyNode *n, float x, float y) :
     _label_fmt = check_format(_format.c_str());
     if (_label_fmt != INT && _label_fmt != LONG
             && _label_fmt != FLOAT && _label_fmt != DOUBLE) {
+        SG_LOG(SG_INPUT, SG_ALERT, "HUD: invalid <format> '" << _format.c_str()
+                << "' in <tape> '" << _name << "' (must be number format)");
         _label_fmt = INT;
         _format = "%d";
     }
@@ -546,6 +548,9 @@ void HUD::Tape::draw(void) //  (HUD_scale * pscale)
 
 char *HUD::Tape::format_value(float v)
 {
+    if (fabsf(v) < 1e-8)
+        v = 0.0f;
+
     if (_label_fmt == INT)
         snprintf(_buf, BUFSIZE, _format.c_str(), int(v + 0.5f));
     else if (_label_fmt == LONG)