Avoid empty callsign objects

This commit is contained in:
Klaus Basan
2018-09-17 18:23:51 +02:00
parent 15a563058f
commit 1f3650e7e2
2 changed files with 5 additions and 2 deletions

View File

@@ -202,12 +202,14 @@ namespace BlackCore
CUserList users;
for (const CAtcStation &station : m_atcStationsOnline)
{
const CUser user = station.getController();
CUser user = station.getController();
if (!user.hasCallsign()) { user.setCallsign(station.getCallsign()); }
users.push_back(user);
}
for (const CSimulatedAircraft &aircraft : this->getAircraftInRange())
{
const CUser user = aircraft.getPilot();
CUser user = aircraft.getPilot();
if (!user.hasCallsign()) { user.setCallsign(aircraft.getCallsign()); }
users.push_back(user);
}
return users;

View File

@@ -232,6 +232,7 @@ namespace BlackMisc
QHash<CCallsign, OBJ> hash;
for (const OBJ &obj : this->container())
{
if (obj.getCallsign().isEmpty()) { continue; }
hash.insert(obj.getCallsign(), obj);
}
return hash;