mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
refs #452, adjusted aircraft/aviation classes
* support for loading from datastore * improved timestamp handling * new color and country classes * new attributes * updates for missing parts in CUser
This commit is contained in:
committed by
Mathew Sutcliffe
parent
c5f7179588
commit
ae24700299
@@ -21,7 +21,6 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
|
||||
CSimulatedAircraftList::CSimulatedAircraftList() { }
|
||||
|
||||
CSimulatedAircraftList::CSimulatedAircraftList(const CSequence<CSimulatedAircraft> &other) :
|
||||
@@ -59,6 +58,26 @@ namespace BlackMisc
|
||||
return csl;
|
||||
}
|
||||
|
||||
bool CSimulatedAircraftList::updateWithVatsimDataFileData(CSimulatedAircraft &aircraftToBeUpdated) const
|
||||
{
|
||||
if (this->isEmpty()) return false;
|
||||
if (aircraftToBeUpdated.hasValidRealName() && aircraftToBeUpdated.hasValidId() && aircraftToBeUpdated.hasAircraftAndAirlineDesignator()) { return false; }
|
||||
|
||||
CSimulatedAircraft currentDataFileAircraft = this->findFirstByCallsign(aircraftToBeUpdated.getCallsign());
|
||||
if (currentDataFileAircraft.getCallsign().isEmpty()) return false;
|
||||
|
||||
CUser user = aircraftToBeUpdated.getPilot();
|
||||
user.updateMissingParts(currentDataFileAircraft.getPilot());
|
||||
aircraftToBeUpdated.setPilot(user);
|
||||
|
||||
CAircraftIcaoCode aircraftIcao = aircraftToBeUpdated.getAircraftIcaoCode();
|
||||
CAirlineIcaoCode airlineIcao = aircraftToBeUpdated.getAirlineIcaoCode();
|
||||
aircraftIcao.updateMissingParts(currentDataFileAircraft.getAircraftIcaoCode());
|
||||
airlineIcao.updateMissingParts(currentDataFileAircraft.getAirlineIcaoCode());
|
||||
aircraftToBeUpdated.setIcaoCodes(aircraftIcao, airlineIcao);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSimulatedAircraftList::markAllAsNotRendered()
|
||||
{
|
||||
for (CSimulatedAircraft &aircraft : (*this))
|
||||
@@ -80,6 +99,18 @@ namespace BlackMisc
|
||||
return c;
|
||||
}
|
||||
|
||||
int CSimulatedAircraftList::setAircraftModel(const CCallsign &callsign, const CAircraftModel &model)
|
||||
{
|
||||
int c = 0;
|
||||
for (CSimulatedAircraft &aircraft : (*this))
|
||||
{
|
||||
if (aircraft.getCallsign() != callsign) { continue; }
|
||||
aircraft.setModel(model);
|
||||
c++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
int CSimulatedAircraftList::setAircraftParts(const CCallsign &callsign, const CAircraftParts &parts)
|
||||
{
|
||||
int c = 0;
|
||||
@@ -113,15 +144,5 @@ namespace BlackMisc
|
||||
return false;
|
||||
}
|
||||
|
||||
CAircraftList CSimulatedAircraftList::toAircraftList() const
|
||||
{
|
||||
CAircraftList al;
|
||||
for (const CSimulatedAircraft &aircraft : (*this))
|
||||
{
|
||||
al.push_back(aircraft);
|
||||
}
|
||||
return al;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user