Skip to content

Commit 89f8f99

Browse files
author
Pierre Ferran
committed
Added controller validation check
1 parent b49b977 commit 89f8f99

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

23.12.2015.modeS.gif

46 KB
Loading

ModeS/ModeS2.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
const string updateUrl = "http://hydra.ferran.io/vatsim/modes.php";
6-
const int VERSION_CODE = 11;
6+
const int VERSION_CODE = 12;
77

88
vector<string> EQUIPEMENT_CODES = { "H", "L", "E", "G", "W", "Q", "S" };
99
vector<string> ICAO_MODES = { "EB", "EL", "LS", "ET", "ED", "LF", "EH", "LK", "LO", "LIM, LIR" };
@@ -55,7 +55,7 @@ void doInitialLoad(void * arg)
5555

5656
CModeS::CModeS(void):CPlugIn(EuroScopePlugIn::COMPATIBILITY_CODE,
5757
"Mode S PlugIn",
58-
"1.1.0e32",
58+
"1.2.0e32",
5959
"Pierre Ferran",
6060
"GPL v3")
6161
{
@@ -142,6 +142,9 @@ void CModeS::OnFunctionCall(int FunctionId, const char * sItemString, POINT Pt,
142142
if (!FlightPlan.IsValid())
143143
return;
144144

145+
if (!ControllerMyself().IsValid() || !ControllerMyself().IsController())
146+
return;
147+
145148
if (FunctionId == TAG_FUNC_ASSIGNMODES && isAcModeS(FlightPlan)) {
146149
string Dest = FlightPlan.GetFlightPlanData().GetDestination();
147150

@@ -161,6 +164,9 @@ void CModeS::OnFlightPlanFlightPlanDataUpdate(CFlightPlan FlightPlan)
161164
if (!FlightPlan.IsValid())
162165
return;
163166

167+
if (!ControllerMyself().IsValid() || !ControllerMyself().IsController())
168+
return;
169+
164170
// Here we assign squawk 1000 to ground aircrafts
165171

166172
const char * assr = FlightPlan.GetControllerAssignedData().GetSquawk();

version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
H,L,E,G,W,Q,S|EB,EL,LS,ET,ED,LF,EH,LK,LO,LIM,LIR|11
1+
H,L,E,G,W,Q,S|EB,EL,LS,ET,ED,LF,EH,LK,LO,LIM,LIR|12

0 commit comments

Comments
 (0)