mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
Read VATSIM servers from servers.json
This commit is contained in:
@@ -88,12 +88,7 @@ namespace BlackCore::Vatsim
|
||||
|
||||
CServerList CVatsimDataFileReader::getVoiceServers() const
|
||||
{
|
||||
return m_lastGoodSetup.get().getVoiceServers();
|
||||
}
|
||||
|
||||
CServerList CVatsimDataFileReader::getFsdServers() const
|
||||
{
|
||||
return m_lastGoodSetup.get().getFsdServers();
|
||||
return {}; // TODO: Method not used anymore with AFV.
|
||||
}
|
||||
|
||||
CUserList CVatsimDataFileReader::getPilotsForCallsigns(const CCallsignSet &callsigns) const
|
||||
@@ -275,16 +270,6 @@ namespace BlackCore::Vatsim
|
||||
}
|
||||
atcStations.push_back(parseController(atis.toObject()));
|
||||
}
|
||||
for (QJsonValueRef server : jsonDoc["servers"].toArray())
|
||||
{
|
||||
if (!this->doWorkCheck())
|
||||
{
|
||||
CLogMessage(this).info(u"Terminated VATSIM file parsing process");
|
||||
return;
|
||||
}
|
||||
fsdServers.push_back(parseServer(server.toObject()));
|
||||
if (!fsdServers.back().hasName()) { fsdServers.pop_back(); }
|
||||
}
|
||||
|
||||
// Setup for VATSIM servers and sorting for comparison
|
||||
fsdServers.sortBy(&CServer::getName, &CServer::getDescription);
|
||||
@@ -298,15 +283,6 @@ namespace BlackCore::Vatsim
|
||||
m_flightPlanRemarks = flightPlanRemarksMap;
|
||||
}
|
||||
|
||||
// update cache itself is thread safe
|
||||
CVatsimSetup vs(m_lastGoodSetup.get());
|
||||
const bool changedSetup = vs.setServers(fsdServers, {});
|
||||
if (changedSetup)
|
||||
{
|
||||
vs.setUtcTimestamp(updateTimestampFromFile);
|
||||
m_lastGoodSetup.set(vs);
|
||||
}
|
||||
|
||||
// warnings, if required
|
||||
if (!illegalEquipmentCodes.isEmpty())
|
||||
{
|
||||
@@ -368,14 +344,6 @@ namespace BlackCore::Vatsim
|
||||
return CAtcStation(callsign, user, freq, {}, range, true, {}, {}, atis);
|
||||
}
|
||||
|
||||
CServer CVatsimDataFileReader::parseServer(const QJsonObject &server) const
|
||||
{
|
||||
return CServer(server["name"].toString(), server["location"].toString(),
|
||||
server["hostname_or_ip"].toString(), 6809, CUser("id", "real name", "email", "password"),
|
||||
CFsdSetup::vatsimStandard(), CVoiceSetup::vatsimStandard(), CEcosystem::VATSIM,
|
||||
CServer::FSDServerVatsim, server["clients_connection_allowed"].toInt());
|
||||
}
|
||||
|
||||
void CVatsimDataFileReader::reloadSettings()
|
||||
{
|
||||
CReaderSettings s = m_settings.get();
|
||||
|
||||
Reference in New Issue
Block a user