# include <config.h>
#endif
-#include <simgear/props/condition.hxx>
#include "HUD.hxx"
_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;
}
void HUD::Label::draw(void)
{
- if (!(_mode == NONE || _input.isValid() && blink()))
+ if (!((_mode == NONE || _input.isValid()) && blink()))
return;
if (_box) {
l = _center_x - pw;
r = _center_x + pw;
- bool draw_parallel = fabsf(_pointer_width - _w) > 2.0; // draw lines left and right of arrow?
+ bool draw_parallel = fabs(_pointer_width - _w) > 2.0; // draw lines left and right of arrow?
if (option_bottom()) {
if (draw_parallel) {
l = _center_y - pw;
r = _center_y + pw;
- draw_parallel = fabsf(_pointer_width - _h) > 2.0;
+ draw_parallel = fabs(_pointer_width - _h) > 2.0;
if (option_left()) {
if (draw_parallel) {
}
const int BUFSIZE = 256;
- char buf[BUFSIZE];
+ char buf[BUFSIZE+1];
+ buf[ BUFSIZE] = '\0'; // Be sure to terminate properly
if (_mode == NONE)
- snprintf(buf, BUFSIZE, _format.c_str());
+ snprintf(buf, BUFSIZE, _format.c_str(), 0);
else if (_mode == STRING)
snprintf(buf, BUFSIZE, _format.c_str(), _input.getStringValue());
else if (_mode == INT)