]> git.mxchange.org Git - flightgear.git/blob - src/ATC/ATCdisplay.hxx
A bunch of reorg and clean up of the KR 87 (adf) code including some
[flightgear.git] / src / ATC / ATCdisplay.hxx
1 // ATCdisplay.hxx - class to manage the graphical display of ATC messages.
2 //                - The idea is to separate the display of ATC messages from their
3 //                - generation so that the generation may come from any source.
4 //
5 // Written by David Luff, started October 2001.
6 //
7 // Copyright (C) 2001  David C Luff - david.luff@nottingham.ac.uk
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 // General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23 #ifndef _FG_ATC_DISPLAY_HXX
24 #define _FG_ATC_DISPLAY_HXX
25
26 #ifdef HAVE_CONFIG_H
27 #  include <config.h>
28 #endif
29
30 #include <Main/fgfs.hxx>
31
32 #include <vector>
33 #include <string>
34
35 SG_USING_STD(vector);
36 SG_USING_STD(string);
37
38 struct atcMessage {
39     string msg;
40     bool repeating;
41     int counter;        // count of how many iterations since posting
42     int start_count;    // value of counter at which display should start
43     int stop_count;     // value of counter at which display should stop
44     int id;
45 };
46
47 // ASSUMPTION - with two radios the list won't be long so we don't need to map the id's
48 typedef vector<atcMessage> atcMessageList;
49 typedef atcMessageList::iterator atcMessageListIterator;
50
51 class FGATCDisplay : public FGSubsystem 
52 {
53
54 private:
55     bool rep_msg;               // Flag to indicate there is a repeating transmission to display
56     bool change_msg_flag;       // Flag to indicate that the repeating message has changed
57     float dsp_offset1;          // Used to set the correct position of scrolling display
58     float dsp_offset2;  
59     string rep_msg_str;         // The repeating transmission to play
60     atcMessageList msgList;
61     atcMessageListIterator msgList_itr;
62
63 public:
64     FGATCDisplay();
65     ~FGATCDisplay();
66
67     void init();
68
69     void bind();
70
71     void unbind();
72
73     // Display any registered messages
74     void update(double dt);
75
76     // Register a single message for display after a delay of delay seconds
77     // Will automatically stop displaying after a suitable interval.
78     void RegisterSingleMessage(string msg, int delay);  // OK - I know passing a string in and out is probably not good but it will have to do for now.
79
80     // For now we will assume only one repeating message at once
81     // This is not really robust
82
83     // Register a continuously repeating message
84     void RegisterRepeatingMessage(string msg);
85
86     // Change a repeating message - assume that the message changes after the string has finished for now
87     void ChangeRepeatingMessage(string newmsg); 
88
89     // Cancel the current repeating message
90     void CancelRepeatingMessage();
91 };
92
93 #endif // _FG_ATC_DISPLAY_HXX