Commit 15bc15e8 authored by Lorenz Meier's avatar Lorenz Meier

Airframe component controller: Load from map instead of array

parent acbacef3
......@@ -58,13 +58,19 @@ AirframeComponentController::AirframeComponentController(void) :
bool autostartFound = false;
_autostartId = getParameterFact(FactSystem::defaultComponentId, "SYS_AUTOSTART")->value().toInt();
for (const AirframeComponentAirframes::AirframeType_t* pType=&AirframeComponentAirframes::rgAirframeTypes[0]; pType->name != NULL; pType++) {
for (unsigned tindex = 0; tindex < AirframeComponentAirframes::rgAirframeTypes.count(); tindex++) {
const AirframeComponentAirframes::AirframeType_t* pType = &AirframeComponentAirframes::rgAirframeTypes.values().at(tindex);
AirframeType* airframeType = new AirframeType(pType->name, pType->imageResource, this);
Q_CHECK_PTR(airframeType);
int index = 0;
for (const AirframeComponentAirframes::AirframeInfo_t* pInfo=&pType->rgAirframeInfo[0]; pInfo->name != NULL; pInfo++) {
for (unsigned index = 0; index < pType->rgAirframeInfo.count(); index++) {
const AirframeComponentAirframes::AirframeInfo_t* pInfo = &pType->rgAirframeInfo.at(index);
if (_autostartId == pInfo->autostartId) {
Q_ASSERT(!autostartFound);
autostartFound = true;
......@@ -73,7 +79,6 @@ AirframeComponentController::AirframeComponentController(void) :
_currentVehicleIndex = index;
}
airframeType->addAirframe(pInfo->name, pInfo->autostartId);
index++;
}
_airframeTypes.append(QVariant::fromValue(airframeType));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment