[Gcblue-commits] gcb_wx/src/common AError.cpp, 1.10, 1.11 simmath.cpp, 1.32, 1.33 tcFile.cpp, 1.7,
Status: Alpha
Brought to you by:
ddcforge
From: Dewitt C. <ddc...@us...> - 2006-09-05 01:04:27
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv24958/src/common Modified Files: AError.cpp simmath.cpp tcFile.cpp Log Message: Index: AError.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/AError.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AError.cpp 17 Aug 2006 01:28:03 -0000 1.10 --- AError.cpp 5 Sep 2006 01:04:25 -0000 1.11 *************** *** 29,105 **** #include "AError.h" #include <stdio.h> - #include <string.h> - #include <wx/string.h> - - - void - ShowAndAbort(char* sString) { - //MessageBox(sString); - //AfxGetMainWnd()->PostMessage(WM_CLOSE, 0, 0); - } - - void - ShowError(char* sString) { - //char buffer[256]; - //sprintf( buffer, "%s", sString); - //MessageBox( NULL, buffer, "ERROR", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL ); - } - - - void - PopupMessage(char* sString) { - //char buffer[256]; - //sprintf( buffer, "%s", sString); - ///MessageBox( NULL, buffer, "Message", MB_OK | MB_ICONINFORMATION | MB_SYSTEMMODAL ); - } - - - - - void - WriteToLog(const char* sString) { - int result; - static int linecount = 0; - static FILE* logfile=NULL; - - - if (strcmp(sString,"FCLOSE")==0) { - if (logfile) fclose(logfile); - return; - } - if (linecount==900) { - fprintf(logfile,"---- LOG STOPPED AT 900 LINES ----\n"); - linecount++; - return; - } - else if (linecount > 900) { - return; - } - - if (logfile==NULL) { - logfile = fopen("log\\log.txt","wt"); - if (logfile==NULL) - { // create directory and try again - wxMkdir("log"); // wxMkdir(L"log") caused link errors on laptop !? - logfile = fopen("log\\log.txt","wt"); - if (logfile==NULL) { - ShowAndAbort("Error opening log file\n"); - } - } - fprintf(logfile,"Log opened\n"); - } - - if (sString==NULL) { - return; - } - - - - result = fprintf(logfile, "%s\n", sString); - linecount++; - - return; } --- 29,37 ---- #include "AError.h" #include <stdio.h> + void WriteToLog(const char* sString) + { + fprintf(stdout, "%s\n", sString); } Index: simmath.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/simmath.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** simmath.cpp 18 Jun 2006 00:44:59 -0000 1.32 --- simmath.cpp 5 Sep 2006 01:04:25 -0000 1.33 *************** *** 352,356 **** else if (mnClassification & (PTYPE_AIR | PTYPE_MISSILE)) { ! return 1000.0f; } else if (mnClassification & PTYPE_FIXED) --- 352,365 ---- else if (mnClassification & (PTYPE_AIR | PTYPE_MISSILE)) { ! float terrain_height_m = ! tcMapData::Get()->GetTerrainHeight(C_180OVERPI*mfLon_rad, C_180OVERPI*mfLat_rad, mfTimestamp); ! if (terrain_height_m <= 900.0f) ! { ! return 1000.0f; ! } ! else ! { ! return terrain_height_m + 100.0f; ! } } else if (mnClassification & PTYPE_FIXED) Index: tcFile.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcFile.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcFile.cpp 23 Mar 2006 01:11:01 -0000 1.7 --- tcFile.cpp 5 Sep 2006 01:04:25 -0000 1.8 *************** *** 23,26 **** --- 23,28 ---- int tcFile::Open(const char *azFileName, unsigned int anFlags) { + errno_t err; + if (mpFile != NULL) { *************** *** 28,45 **** mpFile = NULL; } if (anFlags & modeRead) { if (anFlags & modeText) ! mpFile = fopen(azFileName,"rt"); else ! mpFile = fopen(azFileName,"rb"); } else if (anFlags & modeWrite) { if (anFlags & modeText) ! mpFile = fopen(azFileName,"wt"); else ! mpFile = fopen(azFileName,"wb"); } return mpFile != NULL; } --- 30,51 ---- mpFile = NULL; } + if (anFlags & modeRead) { if (anFlags & modeText) ! err = fopen_s(&mpFile, azFileName, "rt"); else ! err = fopen_s(&mpFile, azFileName, "rb"); } else if (anFlags & modeWrite) { if (anFlags & modeText) ! err = fopen_s(&mpFile, azFileName, "wt"); else ! err = fopen_s(&mpFile, azFileName, "wb"); } + + if (err != 0) mpFile = NULL; + return mpFile != NULL; } |