/** * Adds a FLARM details couple (callsign + FLARM id) * to the FLARM details array and saves it to the * user file (if necessary) * @param id FLARM id * @param name Callsign * @param saveFile True = FLARM details file is saved after update * @return True if successfully added, False otherwise */ bool AddFlarmLookupItem(int id, const TCHAR *name, bool saveFile) { int index = LookupSecondaryFLARMId(id); if (index == -1) { if (NumberOfFLARMNames < MAXFLARMNAMES - 1) { // create new record FLARM_Names[NumberOfFLARMNames].ID = id; _tcsncpy(FLARM_Names[NumberOfFLARMNames].Name, name, 20); FLARM_Names[NumberOfFLARMNames].Name[20] = 0; NumberOfFLARMNames++; SaveFLARMDetails(); return true; } } else { // modify existing record FLARM_Names[index].ID = id; _tcsncpy(FLARM_Names[index].Name, name, 20); FLARM_Names[index].Name[20] = 0; if (saveFile) { SaveFLARMDetails(); } return true; } return false; }
bool AddFlarmLookupItem(int id, TCHAR *name, bool saveFile) { int index = LookupSecondaryFLARMId(id); #ifdef DEBUG_LKT StartupStore(_T("... LookupSecondary id=%d result index=%d\n"),id,index); #endif if (index == -1) { if (NumberOfFLARMNames < MAXFLARMLOCALS) // 100322 { // create new record FLARM_Names[NumberOfFLARMNames].ID = id; _tcsncpy(FLARM_Names[NumberOfFLARMNames].Name, name,MAXFLARMNAME); // was 20 100322 FLARM_Names[NumberOfFLARMNames].Name[MAXFLARMNAME]=0; // was 20 NumberOfFLARMNames++; SaveFLARMDetails(); return true; } } else { // modify existing record FLARM_Names[index].ID = id; _tcsncpy(FLARM_Names[index].Name, name,MAXFLARMNAME); FLARM_Names[index].Name[MAXFLARMNAME]=0; if (saveFile) { SaveFLARMDetails(); } return true; } return false; }
bool AddFlarmLookupItem(int id, TCHAR *name, bool saveFile) { bool bRet = false; int index = LookupSecondaryFLARMId(id); #ifdef DEBUG_LKT StartupStore(_T("... LookupSecondary id=%d result index=%d\n"), id, index); #endif if (index == -1) { if (NumberOfFLARMNames < MAXFLARMLOCALS) { // 100322 // create new record index = NumberOfFLARMNames++; } } if(index != -1) { FLARM_Names[index].ID = id; LK_tcsncpy(FLARM_Names[index].Name, name, MAXFLARMNAME); bRet = true; } if (bRet && saveFile) { SaveFLARMDetails(); } return bRet; }