From a8c7af79abd349d41ddadf25485b3117831385db Mon Sep 17 00:00:00 2001 From: daveluff Date: Wed, 19 Nov 2003 10:16:26 +0000 Subject: [PATCH] Fix a nasty bug whereby non-scrolling ATC messages longer than the screen width were not rendered at all. They are now rendered with the end clipped - that can be fixed later. --- src/ATC/ATCdisplay.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ATC/ATCdisplay.cxx b/src/ATC/ATCdisplay.cxx index 4f75c489e..6d0fda8be 100644 --- a/src/ATC/ATCdisplay.cxx +++ b/src/ATC/ATCdisplay.cxx @@ -168,10 +168,10 @@ void FGATCDisplay::update(double dt) { //cout << "Stopping single message\n"; msgList_itr = msgList.erase(msgList_itr); } else if(m.counter > m.start_count) { - guiFnt.drawString( m.msg.c_str(), - (iwidth - (m.msg.size() * 8))/2, - //iwidth/2, - (iheight - 40) ); // TODO - relate the distance in that the string is rendered to the string length. + int pin = (((int)m.msg.size() * 8) >= iwidth ? 5 : (iwidth - (m.msg.size() * 8))/2); + //cout << m.msg << '\n'; + //cout << "pin = " << pin << ", iwidth = " << iwidth << ", msg.size = " << m.msg.size() << '\n'; + guiFnt.drawString( m.msg.c_str(), pin, (iheight - 40) ); m.counter += dt; msgList[i] = m; ++msgList_itr;