1
0
Fork 0
flightgear/src/ATC/ATCdisplay.hxx
curt e35fffa035 David Luff writes:
Heres an update to the ATIS stuff.  In brief:

The possible buffer overflow in the display with wind should
hopefully be fixed.

Temperature is taken from the global temperature property instead
of being hardwired.

The display class now includes an implementation of the member
function to change the repeating message.

The message callsign is no longer hardwired.  The first message
from each station is generated with a random callsign.
Subsequent messages from the same station have the callsign
incremented every hour.  A map of airport-id vs. last callsign and
transmission time is kept for each station that has transmitted for
the duration of the FlightGear session.  The logic might be flaky if
FlightGear is run for more than 24 hours at a stretch between
visiting the same ATIS station though!  (ie I don't check the day.)
This map is kept in the atislist class.  This might not be the best
long-term place for it (in an ATC class of some sort might be
better), but it works for now.
2001-11-19 23:53:36 +00:00

84 lines
2.7 KiB
C++

// 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.
//
// Written by David Luff, started October 2001.
//
// Copyright (C) 2001 David C Luff - david.luff@nottingham.ac.uk
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// 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.
#ifndef _FG_ATC_DISPLAY_HXX
#define _FG_ATC_DISPLAY_HXX
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <vector>
#include <string>
SG_USING_STD(vector);
SG_USING_STD(string);
struct atcMessage {
string msg;
bool repeating;
int id;
};
// 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;
class FGATCDisplay {
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;
string rep_msg_str; // The repeating transmission to play
atcMessageList msgList;
atcMessageListIterator msgList_itr;
public:
FGATCDisplay();
~FGATCDisplay();
void init();
// Display any registered messages
void update();
// 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.
/* 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);
// Change a repeating message - assume that the message changes after the string has finished for now
void ChangeRepeatingMessage(string newmsg);
// Cancel the current repeating message
void CancelRepeatingMessage();
};
extern FGATCDisplay *current_atcdisplay;
#endif // _FG_ATC_DISPLAY_HXX