]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/ATCdisplay.hxx
If it's a struct, it's not a class
[flightgear.git] / src / ATC / ATCdisplay.hxx
index 952d1eb38b8c7bfe170fb839e2eca70f2d892494..cc3818de9583a998b62d27c36bfa22b0c6b68046 100644 (file)
@@ -1,6 +1,6 @@
 // ATCdisplay.hxx - class to manage the graphical display of ATC messages.
 //                - The idea is to separate the display of ATC messages from their
-//               - generation so that the generation may come from any source.
+//               - generation so that the generation may come from any source.
 //
 // Written by David Luff, started October 2001.
 //
@@ -18,7 +18,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 #ifndef _FG_ATC_DISPLAY_HXX
 #define _FG_ATC_DISPLAY_HXX
 #  include <config.h>
 #endif
 
+#include <simgear/structure/subsystem_mgr.hxx>
+
 #include <vector>
 #include <string>
 
 SG_USING_STD(vector);
 SG_USING_STD(string);
-SG_USING_NAMESPACE(std);
 
 struct atcMessage {
     string msg;
     bool repeating;
+    double counter;            // count of how many seconds since the message was registered
+    double start_count;        // value of counter at which display should start (seconds)
+    double stop_count; // value of counter at which display should stop (seconds)
     int id;
+       double dsp_offset;
 };
 
 // ASSUMPTION - with two radios the list won't be long so we don't need to map the id's
 typedef vector<atcMessage> atcMessageList;
-typedef vector<atcMessage>::iterator atcMessageListIterator;
+typedef atcMessageList::iterator atcMessageListIterator;
 
-class FGATCDisplay {
+class FGATCDisplay : public SGSubsystem 
+{
 
 private:
     bool rep_msg;              // Flag to indicate there is a repeating transmission to display
     bool change_msg_flag;      // Flag to indicate that the repeating message has changed
-    float dsp_offset1;         // Used to set the correct position of scrolling display
-    float dsp_offset2; 
+    double dsp_offset1;                // Used to set the correct position of scrolling display
+    double dsp_offset2;
     string rep_msg_str;                // The repeating transmission to play
     atcMessageList msgList;
     atcMessageListIterator msgList_itr;
@@ -61,25 +67,28 @@ public:
 
     void init();
 
+    void bind();
+
+    void unbind();
+
     // Display any registered messages
-    void update();
+    void update(double dt);
 
-    // Register a single message for display when possible
-    void RegisterSingleMessage(string msg);    // OK - I know passing a string in and out is probably not good but it will have to do for now.
+    // Register a single message for display after a delay of delay seconds
+    // Will automatically stop displaying after a suitable interval.
+    void RegisterSingleMessage(const string& msg, double delay = 0.0);
 
-/* For now we will assume only one repeating message at once */
+    // For now we will assume only one repeating message at once
     // This is not really robust
 
     // Register a continuously repeating message
-    void RegisterRepeatingMessage(string msg);
+    void RegisterRepeatingMessage(const string& msg);
 
     // Change a repeating message - assume that the message changes after the string has finished for now
-    void ChangeRepeatingMessage(string newmsg); 
+    void ChangeRepeatingMessage(const string& newmsg); 
 
     // Cancel the current repeating message
     void CancelRepeatingMessage();
 };
 
-extern FGATCDisplay *current_atcdisplay;
-
 #endif // _FG_ATC_DISPLAY_HXX