Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vSMR/SMRPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ CRadarScreen * CSMRPlugin::OnRadarScreenCreated(const char * sDisplayName, bool
{
Logger::info(string(__FUNCSIG__));
if (!strcmp(sDisplayName, MY_PLUGIN_VIEW_AVISO)) {
CSMRRadar* rd = new CSMRRadar();
CSMRRadar* rd = new CSMRRadar(this);
RadarScreensOpened.push_back(rd);
return rd;
}
Expand Down
12 changes: 8 additions & 4 deletions vSMR/SMRRadar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bool mouseWithin(CRect rect) {

// ReSharper disable CppMsExtAddressOfClassRValue

CSMRRadar::CSMRRadar()
CSMRRadar::CSMRRadar(CPlugIn *plugin)
{

Logger::info("CSMRRadar::CSMRRadar()");
Expand Down Expand Up @@ -120,7 +120,8 @@ CSMRRadar::CSMRRadar()

Logger::info("Loading WIP areas");
string raw;
string url = "https://raw.githubusercontent.com/VATSIM-UK/uk-controller-pack/refs/heads/main/.data/vSMR_WIP_areas.txt";
const char *altUrl = plugin->GetDataFromSettings("smr_areas_url");
string url = altUrl ? altUrl : "https://ukcp.vatsim.uk/api/smr-areas";
HttpHelper* httpHelper = new HttpHelper();
raw.assign(httpHelper->downloadStringFromURL(url));

Expand All @@ -130,8 +131,11 @@ CSMRRadar::CSMRRadar()
while (getline(ss, line, '\n')) {
if (startsWith("COORD:", line.c_str())) {
CPosition pos;
pos.LoadFromStrings(line.substr(21, 14).c_str(), line.substr(6, 14).c_str());
wipArea.push_back(pos);
if (
line.size() >= 21 &&
pos.LoadFromStrings(line.substr(21, 14).c_str(), line.substr(6, 14).c_str())
)
wipArea.push_back(pos);
}
else {
if (wipArea.size() > 0) {
Expand Down
2 changes: 1 addition & 1 deletion vSMR/SMRRadar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CSMRRadar :
public EuroScopePlugIn::CRadarScreen
{
public:
CSMRRadar();
CSMRRadar(CPlugIn *plugin);
virtual ~CSMRRadar();

static map<string, string> vStripsStands;
Expand Down