/*---------------------------------------------------------------------------------------------- Process notifications from user. ----------------------------------------------------------------------------------------------*/ bool GeneralPropDlgTab::OnNotifyChild(int ctid, NMHDR * pnmh, long & lnRet) { AssertPtr(pnmh); if (m_fInitialized) { switch (pnmh->code) { case EN_KILLFOCUS: { if (pnmh->idFrom == m_ctidName) { StrAppBufHuge strbh; int cch = ::SendDlgItemMessage(m_hwnd, m_ctidName, WM_GETTEXT, strbh.kcchMaxStr, (LPARAM)strbh.Chars()); strbh.SetLength(cch); if (cch) { FixString(strbh); ::SetWindowText(::GetDlgItem(m_hwnd, m_ctidName), strbh.Chars()); if (!m_ppropd->CheckName(strbh.Chars())) { StrApp strA(kstidTlsLstsNameExist); StrApp strB(kstidTlsLstsNameExistC); ::MessageBox(m_hwnd, strA.Chars(), strB.Chars(), MB_OK | MB_ICONINFORMATION); ::SetFocus(::GetDlgItem(m_hwnd, m_ctidName)); return false; } m_ppropd->SetName(strbh.Chars()); } else // List must have a name. ::SetWindowText(::GetDlgItem(m_hwnd, m_ctidName), m_ppropd->GetName()); } else if (pnmh->idFrom == kctidGeneralPropTabDescription) { StrAppBufHuge strbh; int cch = ::SendDlgItemMessage(m_hwnd, kctidGeneralPropTabDescription, WM_GETTEXT, strbh.kcchMaxStr, (LPARAM)strbh.Chars()); strbh.SetLength(cch); FixString(strbh); ::SetWindowText(::GetDlgItem(m_hwnd, kctidGeneralPropTabDescription), strbh.Chars()); m_ppropd->SetDescription(strbh.Chars()); } } break; } } return AfWnd::OnNotifyChild(ctid, pnmh, lnRet); }
//BGI 使用0xA表示换行 string WINAPI GetString(PBYTE BufferStart, ULONG& Offset) { ULONG Value = *(PULONG)(BufferStart + Offset); Offset += 4; WCHAR WideString[1500] = { 0 }; CHAR UTF8Name[2000] = { 0 }; ScriptHeader* Header = (ScriptHeader*)BufferStart; ULONG HeaderSize = Header->HeaderSize - sizeof(ULONG) + sizeof(ScriptHeader); MultiByteToWideChar(JPMode ? 932 : 936, 0, (CHAR*)(BufferStart + Value + HeaderSize), lstrlenA((CHAR*)(BufferStart + Value + HeaderSize)), WideString, 1500); WideCharToMultiByte(CP_UTF8, 0, WideString, lstrlenW(WideString), UTF8Name, 2000, nullptr, nullptr); #ifndef DUMP_TEXT_ONLY return FixString("\"" + string(UTF8Name) + "\""); #else return FixString(string(UTF8Name)); #endif }
FixString FixString::stripUntil(char c) { if (_len == 0) return FixString(); const char* newStr = _str; int newLen = 0; while(_len>0) { if (*_str == c) { _str++; _len--; break; } _str++; _len--; newLen++; } return FixString(newStr, newLen); }
// funkcja obliczaj¹ca wartoœæ wysokoœci na podstawie zmierzonego ciœnienia // oraz podanego QNH. Linijki oznaczone jako "pomiary" s¹ odpowiedzialne za // transmisjê tych odczytów przez port szeregowy float AltiFromPressure(float pressure, int qnh) { char temp[10]; // pomiary char* endl = ";\n\r"; // pomiary float output, powexp; powexp = 1/5.255; output = 44330 * (1 - pow((pressure / qnh),powexp)); if (SrlTXing != 1) { //// pomiary float2string(pressure,temp, 2); /// pomiary strcpy(temp+7,endl); /// pomiary FixString(temp,10); //// pomiary SrlSendData(temp); //// pomiary } return output; }
void CreateManufacturerFolders(int parent_index) { int i,jj; int nGames = GetNumGames(); int start_folder = numFolders; LPTREEFOLDER lpFolder = treeFolders[parent_index]; // not sure why this is added separately // should find out at some point. LPTREEFOLDER lpTemp; lpTemp = NewFolder("Romstar", next_folder_id++, parent_index, IDI_MANUFACTURER, GetFolderFlags(numFolders)); AddFolder(lpTemp); // no games in top level folder SetAllBits(lpFolder->m_lpGameBits,FALSE); for (jj = 0; jj < nGames; jj++) { const char *s = FixString(drivers[jj]->manufacturer); const char *s2 = LicenseManufacturer(drivers[jj]->manufacturer); if (s == NULL || s[0] == '\0') continue; // look for an extant manufacturer treefolder for this game for (i=numFolders-1;i>=start_folder;i--) { if (strncmp(treeFolders[i]->m_lpTitle,s,20) == 0 || (s2 != NULL && strncmp(treeFolders[i]->m_lpTitle,s2,20) == 0)) { AddGame(treeFolders[i],jj); break; } } if (i == start_folder-1) { // nope, it's a manufacturer we haven't seen before, make it. lpTemp = NewFolder(s, next_folder_id++, parent_index, IDI_MANUFACTURER, GetFolderFlags(numFolders)); AddFolder(lpTemp); AddGame(lpTemp,jj); } } }
void MainScreen(float vario, float alti, int fltime, int settings) { // zmienna settings okresla jakie dane powinny byæ wyœwietlane na ekranie g³ównym // jest to zalezne od ustawienia badz nie poszczególnych bitow. Rozpiska znajduje siê poni¿ej // // bit 0 [LSB] -- Gdy ustawiony wyœwietlanie drugiego wysokoœciomierza zamiast pierwszego // bit 1 -- Gdy ustawiony wyœwietlanie wartoœci maksymalnego przewy¿szenia zamiast wysokoœci // bit 2 -- Gdy ustawiony wyœwietlanie wartoœci œredniej wariometru zamiast chwilowej // bit 3 -- Gdy ustawiony wyœwietlanie maksymalnego wznoszenia zamiast wariometru // bit 4 -- Gdy ustawiony wyœwietlanie maksymalnego opadania zamiast wariometru // bit 5 -- Gdy ustawiony bargraf wariometru u¿ywa skali logarytmicznej od 0 do 20 ze œrodkiem w 2 // Gdy nie ustawiony skala jest liniowa od 0 do 8 ze œrodkiem w 4 char Main1Line[17]; char Main2Line[17]; char Main3Line[17]; // char Main4Line[16]; char L1Buff[6]; // Bufor dla wartoœci liczbowych w pierwszej linijsce (domyœlnie czas lotu) char L2Buff[9]; // Bufor dla wartoœci liczbowych w drugiej linijsce (domyœlnie wysokoœæ) )))) 6 char L3Buff[8]; // Bufor dla wartoœci liczbowych w trzeciej linijsce (domyœlnie wariometr) // char* temp = ";\n\r"; ////////////////////////////////////////////////////////////////////////////////// /////////////// KLAWISZOLOGIA NA EKRANIE G£ÓWNYM ////////////////////////////////////////////////////////////////////////////////// // D-Pad W DÓ£: Prze³¹cza wysokoœciomierze. D³u¿sze przytrzymanie resetuje ALTI2 // D-Pad W GÓRÊ: Zatrzymuje i startuje odliczanie czasu lotu // D-Pad W LEWO: // D-Pad W PRAWO: Przechodzi do Pamiêci i podsumowania lotów // D-Pad OK: Przechodzi do Menu G³ównego ////////////////////////////////////////////////////////////////////////////////// if ((settings & 0x1) == 0x1) // druga linia wyœwietlacza strcpy(Main2Line, Alti2Line); if ((settings & (0x1 << 1)) == (0x1 << 1)) strcpy(Main2Line, MaxAltGain); if (((settings & 0x1) | (settings & (0x1 << 1))) == 0x0) strcpy(Main2Line, Alti1Line); float2string(alti,L2Buff,1); if (alti > -1000.0 && alti <= -100.0) strcpy(Main2Line+7, L2Buff); if (alti > -100.0 && alti <= -10.0) strcpy(Main2Line+8, L2Buff); if (alti > -10.0 && alti <= 0.0) strcpy(Main2Line+9, L2Buff); if (alti < 10.0 && alti >= 0.0) strcpy(Main2Line+10, L2Buff); if (alti >= 10.0 && alti < 100.0) strcpy(Main2Line+9, L2Buff); if (alti >= 100.0 && alti < 1000.0) strcpy(Main2Line+8, L2Buff); if (alti >= 1000.0 && alti < 10000.0) strcpy(Main2Line+7, L2Buff); FixString(Main2Line,16); // usuwanie niepotrzebnych znaków koñca ci¹gu HDPrintString(Main2Line,2,1); // wysy³anie gotowego wiersza do wyœwietlacza // strcpy(ddupa,L2Buff); /////////////////////////////////////////////////////////////////////////////// if ((settings & (0x1 << 2)) == (0x1 << 2)) // trzecia linijka strcpy(Main3Line, VarioAvgLine); if ((settings & (0x1 << 3)) == (0x1 << 3)) strcpy(Main3Line, MaxClimbingLine); if ((settings & (0x1 << 4)) == (0x1 << 4)) strcpy(Main3Line, MaxDescendingLine); if (((settings & (0x1 << 2)) | (settings & (0x1 << 3)) | (settings & (0x1 << 4))) == 0x0) { strcpy(Main3Line, VarioLine); float2string(vario,L3Buff,1); if (vario <= -10.0) strcpy(Main3Line+6, L3Buff); if (vario > -9.9 && vario < 0.0) strcpy(Main3Line+7, L3Buff); if (vario >= 0.0 && vario < 10.0) strcpy(Main3Line+8, L3Buff); if (vario >= 10.0) strcpy(Main3Line+7, L3Buff); FixString(Main3Line,16); HDPrintString(Main3Line,3,1); } //////////////////////////////////////////////////////////////////////////////// if (vario != 0) { if ((settings & (0x1 << 5)) == 0x0) { // bargraf w czwartej linijce if (vario <= -7) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph1h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (1); } if (vario > -7 && vario <= -6.5) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph2h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (2); } if (vario > -6.5 && vario <= -6) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph3h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (3); } if (vario > -6 && vario <= -5.5) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph4h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (4); } if (vario > -5.5 && vario <= -5) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph5h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (5); } if (vario > -5 && vario <= -4.5) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph6h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (6); } if (vario > -4.5 && vario <= -4) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph7h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (7); } if (vario > -4 && vario <= -3.5) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph8h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (8); } if (vario > -3.5 && vario <= -3) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph9h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (9); } if (vario > -3 && vario <= -2.5) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph10h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (10); } if (vario > -2.5 && vario <= -2) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph11h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (11); } if (vario > -2 && vario <= -1.5) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph12h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (12); } if (vario > -1.5 && vario <= -1) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph13h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (13); } if (vario > -1 && vario <= -0.5) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph14h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (14); } if (vario > -0.5 && vario < 0) { HDPrintString(Bargraph16h,4,9); HDPrintString(Bargraph15h,4,1); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (15); } if (vario > 0 && vario <= 0.5) { // ZERO HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph1h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (16); } if (vario > 0.5 && vario <= 1) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph2h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (17); } if (vario > 1 && vario <= 1.5) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph3h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (18); } if (vario > 1.5 && vario <= 2) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph4h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (19); } if (vario > 2 && vario <= 2.5) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph5h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (20); } if (vario > 2.5 && vario <= 3) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph6h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (21); } if (vario > 3 && vario <= 3.5) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph7h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (22); } if (vario > 3.5 && vario <= 4) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph8h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (23); } if (vario > 4 && vario <= 4.5) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph9h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (24); } if (vario > 4.5 && vario <= 5) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph10h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (25); } if (vario > 5 && vario <= 5.5) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph11h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (26); } if (vario > 5.5 && vario <= 6) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph12h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (27); } if (vario > 6 && vario <= 6.5) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph13h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (28); } if (vario > 6.5 && vario <= 7) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph14h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (29); } if (vario > 7 && vario <= 7.5) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph15h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (30); } if (vario > 7.5) { HDPrintString(Bargraph16h,4,1); HDPrintString(Bargraph15h,4,9); TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (31); } } if ((settings & (0x1 << 5)) != (0x1 << 5)) { if (vario > 0 && vario <= 0.5); if (vario > 0.5 && vario <= 1); if (vario > 1 && vario <= 1.5); if (vario > 1.5 && vario <= 2); if (vario > 2 && vario <= 2.5); if (vario > 2.5 && vario <= 3); if (vario > 3 && vario <= 3.5); if (vario > 3.5 && vario <= 4); if (vario > 4 && vario <= 4.5); if (vario > 4.5 && vario <= 5); if (vario > 5 && vario <= 5.5); if (vario > 5.5 && vario <= 6); if (vario > 6 && vario <= 6.5); if (vario > 6.5 && vario <= 7); if (vario > 7 && vario <= 7.5); if (vario > 7.5); } } else; // je¿eli wskazanie wariometru jest równe 0 to bargraf jest pusty //////////////////////////////////////////////////////////////////////////////// strcpy(Main1Line, AirTimeLine); // pierwsza linijka , zawsze czas int2string((int)fltime/2,L1Buff); if (((int)fltime/2) < 10) strcpy(Main1Line+12, L1Buff); if (((int)fltime/2) < 100 && ((int)fltime/2) >= 10) strcpy(Main1Line+11, L1Buff); if (((int)fltime/2) < 1000 && ((int)fltime/2) >= 100) strcpy(Main1Line+10, L1Buff); if (((int)fltime/2) < 10000 && ((int)fltime/2) >= 1000) strcpy(Main1Line+9, L1Buff); FixString(Main1Line,16); HDPrintString(Main1Line,1,1); //////////////////////////// // TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (j); // SrlSendData((int*)L2Buff); ////// if (SrlTXing != 1) { ////// strcpy(L2Buff+6,temp); ////// FixString(L2Buff,9); ////// SrlSendData(L2Buff); ////// } // HDPrintString(Bargraph16h,4,1); // HDPrintString(Bargraph16h,4,8); }
void GetInstInfo() { GetMakeMacro("F77", F77); FixString(F77); GetMakeMacro("F77FLAGS", F77FLAGS); FixString(F77FLAGS); GetMakeMacro("ICC", ICC); FixString(ICC); GetMakeMacro("ICCFLAGS", ICCFLAGS); FixString(ICCFLAGS); GetMakeMacro("SMC", SMC); FixString(SMC); GetMakeMacro("SMCFLAGS", SMCFLAGS); FixString(SMCFLAGS); GetMakeMacro("DMC", DMC); FixString(DMC); GetMakeMacro("DMCFLAGS", DMCFLAGS); FixString(DMCFLAGS); GetMakeMacro("SKC", SKC); FixString(SKC); GetMakeMacro("SKCFLAGS", SKCFLAGS); FixString(SKCFLAGS); GetMakeMacro("DKC", DKC); FixString(DKC); GetMakeMacro("DKCFLAGS", DKCFLAGS); FixString(DKCFLAGS); GetMakeMacro("ARCHDEFS", ARCHDEFS); FixString(ARCHDEFS); GetMakeMacro("F2CDEFS", F2CDEFS); FixString(F2CDEFS); GetMakeMacro("INSTFLAGS", INSTFLAGS); FixString(INSTFLAGS); GetMakeMacro("ARCH", ARCH); FixString(ARCH); GetVers(DKC, DKCVERS); FixString(DKCVERS); GetVers(SKC, SKCVERS); FixString(SKCVERS); GetVers(DMC, DMCVERS); FixString(DMCVERS); GetVers(SMC, SMCVERS); FixString(SMCVERS); GetVers(ICC, ICCVERS); FixString(ICCVERS); GetVers(F77, F77VERS); FixString(F77VERS); if (CmndOneLine("uname -a", SYS)) strcpy(UNAM, "UNKNOWN"); else FixString(SYS); if (CmndOneLine("whoami", UNAM)) strcpy(UNAM, "UNKNOWN"); FixString(UNAM); if (CmndOneLine("date", DATE)) strcpy(DATE, "UNKNOWN"); FixString(DATE); }
void ReadStudents(/*In*/FILE *students, /*In*/student_struct s_list[]){ int count = 0; // Student count float gpa_temp = 0.00; // Temp holding gpa char buffer1[80], buffer2[80]; // File grab buffers 1 and 2 char temp_number[STUDENT_NUMBER_WIDTH+1]; // Temp student number char temp_last[16], temp_first[11], temp_middle[16]; // Temp name buffers char temp_buffer[20]; // Temp buffer student_struct *s = NULL; // Student pointer // // Reset students file // rewind(students); // // Loop while the line grabs are both valid and count is less than max // while((GetLine(students, buffer1, 80))&& (GetLine(students, buffer2, 80))&& (count < MAX_STUDENTS)) { // // Get temp student number from buffer1 // GetDigitString(buffer1, temp_number, STUDENT_NUMBER_WIDTH, 0); // // Assign student pointer to (count)student // s = &s_list[count]; // // If student is active // if (s->active_student) { // // If the student has grades // if (HaveGrades(s_list, temp_number)) { // Get the last name and put in temp_last GetAlphaString(buffer1, temp_last, 15, 5, 0); // Make last name lowercase MakeLowerName(temp_last); // Get the first name and put in temp_first GetAlphaString(buffer1, temp_first, 10, 20, 0); // Make first name lowercase MakeLowerName(temp_first); // Get the middle name and put in temp middle GetAlphaString(buffer1, temp_middle, 15, 30, 1); // Fix spaces in middle string FixString(temp_middle); // Make middle name lowercase MakeLowerName(temp_middle); // Print all temp name buffers into student name string sprintf(s->name, "%s, %s, %c", temp_last, temp_first, temp_middle[0]); // Get the year from the second buffer GetDigitString(buffer2, s->year, SMALL_INFO_WIDTH, 33); // Get the major from the second buffer GetAlphaString(buffer2, s->major, COURSE_INFO_WIDTH, 34, 1); // Get the hoursCom and gpa from second buffer GetString(buffer2, temp_buffer, 20, 39); // Fix spaces in temp buffer FixString(temp_buffer); // Scan the total hours and gpa_temp from temp_buffer sscanf(temp_buffer, "%d %f", &s->hoursCom_total, &gpa_temp); // Assign gpa_temp to gpa_total s->gpa_total = gpa_temp; // Increment counter count++; }; }; }; }
struct GPSData ParseNMEA(char* input) { struct GPSData output; // struktura z przetworzonymi danymi. W zale¿noœci od typu ramki // bêd¹ siê tutaj znajdowaæ ró¿ne dane, dlatego funkcja wywo³uj¹ca // musi sama wiedzieæ co gdzie jest ////////////////////////////////// char fields[20][20]; // tablica zawieraj¹ca rozdzielone pola ramki NMEA char temp[50]; // tablica pomocnicza do konwersji z typu char na float i int int ic =0, ij = 0; int field_number = 0; if (*input != '\0') { // je¿eli przekazano nie pusty ci¹g znaków ////////////////////////////////////////////////////////////////////////////// ///// PRZEPISYWANIE I ROZDZIELANIE PÓL Z RAMKI NMEA DO OSOBNEJ TABLICY ///////////////////////////////////////////////////////////////////////////// for (ic = 0;(*(input + ic) != 0x0D && ic <= 120) ;ic++) { if (*(input + ic + 1) != ',') { fields[field_number][ij] = *(input + ic); ij++; } else { fields[field_number][ij] = *(input + ic); fields[field_number][ij+1] = 0x00; field_number++; ic++; ij = 0; } } //////////////////////////////////////////////////////////////////////////////// if (strcmp(fields[0], "$GPGGA") == 0 && (fields[6][0] == 0x31 || fields[6][0] == 0x32)) { output.FrameType = 0x01; // ramka typu GGA //////////////////////////////////////////// DLUGOSC GEOGRAFICZNA strcpy(temp,fields[2]); FixString(temp,9); output.First = atof(temp); if (fields[3][0] == 'N') output.Fifth = 0x00; // pó³kula pó³nocna else if (fields[3][0] == 'S') output.Fifth = 0x01; // pó³kula po³udniowa else output.Fifth = 0xFF; // b³¹d ////////////////////////////////////////////// SZEROKOSC GEOGRAFICZNA strcpy(temp,fields[4]); FixString(temp,10); output.Second = atof(temp); if (fields[5][0] == 'E') output.Fourth = 0x00; else if (fields[5][0] == 'W') output.Fourth = 0x01; else output.Fifth = 0xFF; ///////////////////////////////////////////////// WYSOKOŒÆ GPS strcpy(temp,fields[9]); FixString(temp,5); output.Third = atoi(temp); ////////////////////////////////////////////// CZAS UTC strcpy(temp,fields[1]); FixString(temp,10); output.Sixth = (int)(atof(temp) / 10000 ); // godzina output.Seventh = (int)((atoi(temp) / 100) % (output.Sixth * 100) ); // minuta output.Eighth = (int)(atoi(temp) % (output.Sixth * 10000 + output.Seventh * 100 )); // sekunda return output; } //////////////////////////////////////////////////////////////////////////////////// else if (strcmp(fields[0], "$GPRMC") == 0 && fields[2][0] == 'A') { output.FrameType = 0x02; // ramka typu RMC ////////////////////////////////////////// PRÊDKOŒÆ WZGLÊDEM ZIEMII strcpy(temp,fields[7]); FixString(temp,5); output.First = atof(temp); output.First *= 1.852; // prêdkoœæ przeliczona z wêz³ów na km.h ////////////////////////////////////////// KURS WZGLÊDEM ZIEMII strcpy(temp,fields[8]); FixString(temp,5); output.Second = atof(temp); ///////////////////////////////////////////// AKTUALNE DATA strcpy(temp,fields[9]); FixString(temp,6); output.Eighth = (int)(atoi(temp) / 10000); // dzieñ output.Seventh = (int)((atoi(temp) / 100) % (output.Eighth * 100) ); // miesi¹c output.Sixth = (int)(atoi(temp) % (output.Seventh * 100 + output.Eighth * 10000 )); // rok } else output.First = -1; // fix niepoprawny b¹dŸ uszkodzony } return output; }
bool CslGameRedEclipse::ParseDefaultPong(ucharbuf& buf,CslServerInfo& info) const { vector<int>attr; wxUint32 l,numattr; char text[_MAXDEFSTR]; bool wasfull=info.IsFull(); l=getint(buf); if (info.HasRegisteredEvent(CslServerEvents::EVENT_EMPTY) && info.Players>0 && !l) info.SetEvents(CslServerEvents::EVENT_EMPTY); else if (info.HasRegisteredEvent(CslServerEvents::EVENT_NOT_EMPTY) && !info.Players && l>0) info.SetEvents(CslServerEvents::EVENT_NOT_EMPTY); info.Players=l; numattr=getint(buf); loopj(numattr) attr.add(getint(buf)); if (numattr>=1) { info.Protocol=attr[0]; info.Version=GetVersionName(info.Protocol); } if (numattr>=2) info.GameMode=GetModeName(attr[1],attr[2]); if (numattr>=4) info.TimeRemain=attr[3]; if (numattr>=5) { info.PlayersMax=attr[4]; if (info.HasRegisteredEvent(CslServerEvents::EVENT_FULL) && !wasfull && info.IsFull()) info.SetEvents(CslServerEvents::EVENT_FULL); else if (info.HasRegisteredEvent(CslServerEvents::EVENT_NOT_FULL) && wasfull && !info.IsFull()) info.SetEvents(CslServerEvents::EVENT_NOT_FULL); } l=info.MM; info.MM=CSL_SERVER_OPEN; info.MMDescription.Empty(); if (numattr>=6) { if (attr[5]==MM_PASSWORD) { info.MMDescription<<wxT("PASS"); info.MM|=CSL_SERVER_PASSWORD; } else { info.MMDescription=wxString::Format(wxT("%d"),attr[5]); if (attr[5]==MM_OPEN) info.MMDescription<<wxT(" (O)"); else if (attr[5]==MM_VETO) { info.MMDescription<<wxT(" (V)"); info.MM=CSL_SERVER_VETO; } else if (attr[5]==MM_LOCKED) { if (info.HasRegisteredEvent(CslServerEvents::EVENT_LOCKED) && CSL_MM_IS_VALID(l) && !CSL_SERVER_IS_LOCKED(l)) info.SetEvents(CslServerEvents::EVENT_LOCKED); info.MMDescription<<wxT(" (L)"); info.MM=CSL_SERVER_LOCKED; } else if (attr[5]==MM_PRIVATE) { if (info.HasRegisteredEvent(CslServerEvents::EVENT_PRIVATE) && CSL_MM_IS_VALID(l) && !CSL_SERVER_IS_PRIVATE(l)) info.SetEvents(CslServerEvents::EVENT_PRIVATE); info.MMDescription<<wxT(" (P)"); info.MM=CSL_SERVER_PRIVATE; } } } getstring(text,buf); info.Map=A2U(text); getstring(text,buf); l=(wxInt32)strlen(text); FixString(text,&l,1); info.SetDescription(A2U(text)); return !buf.overread(); }