// Used by TeamCode, to select a CN and get back the Id int LookupFLARMDetails(TCHAR *cn) { // try to find flarm from userFile int index = LookupSecondaryFLARMId(cn); if (index != -1) { return FLARM_Names[index].ID; } // try to find flarm from FLARMNet.org File FlarmId* flarmId = file.GetFlarmIdItem(cn); if (flarmId != NULL) { return flarmId->GetId(); } return 0; }
// returns Name or Cn to be used TCHAR* LookupFLARMCn(long id) { // try to find flarm from userFile int index = LookupSecondaryFLARMId(id); if (index != -1) { return FLARM_Names[index].Name; } // try to find flarm from FLARMNet.org File FlarmId* flarmId = file.GetFlarmIdItem(id); if (flarmId != NULL) { return flarmId->cn; } return NULL; }
static void SetValues(int indexid) { //TCHAR *name = 0; //TCHAR *cn = 0; WndProperty* wp; TCHAR buffer[80]; //TCHAR status[10]; //static TCHAR Name[MAXFLARMNAME+1]; //static TCHAR Cn[MAXFLARMCN+1]; int wlen; if (indexid<0 || indexid>MAXTRAFFIC) { StartupStore(_T("--- LK setvalues invalid indexid=%d%s"),indexid,NEWLINE); // DoStatusMessage(_T("ERR-216 INVALID INDEXID")); return; } if ( LKTraffic[indexid].ID <=0 || LKTraffic[indexid].Status <LKT_REAL) { StartupStore(_T("--- LK setvalues invalid indexid=%d%s"),indexid,NEWLINE); // DoStatusMessage(_T("ERR-217 INVALID INDEXID")); return; } wp = (WndProperty*)wf->FindByName(TEXT("prpRegName")); if (wp) { wlen=wcslen(LKTraffic[indexid].Name); // a ? probably if (wlen==1) { _stprintf(buffer,_T("%06x"),LKTraffic[indexid].ID); buffer[MAXFLARMNAME]='\0'; } else { _tcsncpy(buffer,LKTraffic[indexid].Name,MAXFLARMNAME); buffer[MAXFLARMNAME]='\0'; ConvToUpper(buffer); } //name=Name; wp->SetText(buffer); wp->RefreshDisplay(); } #if 0 wp = (WndProperty*)wf->FindByName(TEXT("prpStatus")); if (wp) { switch(LKTraffic[indexid].Status) { case LKT_REAL: _tcscpy(status,_T("LIVE")); break; case LKT_GHOST: _tcscpy(status,_T("GHOST")); break; case LKT_ZOMBIE: _tcscpy(status,_T("ZOMBIE")); break; default: _tcscpy(status,_T("UNKNOWN")); break; } wp->SetText(status); wp->RefreshDisplay(); } #endif wp = (WndProperty*)wf->FindByName(TEXT("prpCn")); if (wp) { if ( _tcslen(LKTraffic[indexid].Cn) == 1 ) { if (LKTraffic[indexid].Cn[0] == _T('?')) { _tcscpy(buffer,_T("")); } else { _tcsncpy(buffer,LKTraffic[indexid].Cn,MAXFLARMCN); buffer[MAXFLARMCN]='\0'; } } else { _tcsncpy(buffer,LKTraffic[indexid].Cn,MAXFLARMCN); buffer[MAXFLARMCN]='\0'; } wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpDistance")); if (wp) { _stprintf(buffer,_T("%.1f %s"),LKTraffic[indexid].Distance*DISTANCEMODIFY, Units::GetDistanceName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAltitude")); if (wp) { _stprintf(buffer,_T("%.0f %s"),LKTraffic[indexid].Altitude*ALTITUDEMODIFY, Units::GetAltitudeName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAltDiff")); if (wp) { // this has to be reverted, because it is a relative altitude to us _stprintf(buffer,_T("%+.0f %s"),(CALCULATED_INFO.NavAltitude - LKTraffic[indexid].Altitude)*ALTITUDEMODIFY*-1, Units::GetAltitudeName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpSpeed")); if (wp) { _stprintf(buffer,_T("%.0f %s"),LKTraffic[indexid].Speed*SPEEDMODIFY, Units::GetHorizontalSpeedName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpVario")); if (wp) { _stprintf(buffer,_T("%+.1f %s"),LKTraffic[indexid].Average30s*LIFTMODIFY, Units::GetVerticalSpeedName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpBearing")); if (wp) { _stprintf(buffer, TEXT(" %d")TEXT(DEG), iround(LKTraffic[indexid].Bearing)); wp->SetText(buffer); wp->RefreshDisplay(); } FlarmId* flarmId = file.GetFlarmIdItem(LKTraffic[indexid].ID); if (flarmId != NULL) { wp = (WndProperty*)wf->FindByName(TEXT("prpName")); if (wp) { _stprintf(buffer,_T("%s"),flarmId->name); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAirfield")); if (wp) { _stprintf(buffer,_T("%s"),flarmId->airfield); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpType")); if (wp) { _stprintf(buffer,_T("%s"),flarmId->type); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFreq")); if (wp) { _stprintf(buffer,_T("%s"),flarmId->freq); wp->SetText(buffer); wp->RefreshDisplay(); } } }