================= ReadSaveDirectory ================= */ JLFSAVEGAME MPNOTUSED
| 6507 | */ |
| 6508 | //JLFSAVEGAME MPNOTUSED |
| 6509 | void ReadSaveDirectory (void) |
| 6510 | { |
| 6511 | int i; |
| 6512 | char *holdChar; |
| 6513 | int len; |
| 6514 | int fileCnt; |
| 6515 | // Clear out save data |
| 6516 | memset(s_savedata,0,sizeof(s_savedata)); |
| 6517 | s_savegame.saveFileCnt = 0; |
| 6518 | Cvar_Set("ui_gameDesc", "" ); // Blank out comment |
| 6519 | Cvar_Set("ui_SelectionOK", "0" ); |
| 6520 | #ifdef JK2_MODE |
| 6521 | memset( screenShotBuf,0,(SG_SCR_WIDTH * SG_SCR_HEIGHT * 4)); //blank out sshot |
| 6522 | #endif |
| 6523 | |
| 6524 | |
| 6525 | // Get everything in saves directory |
| 6526 | fileCnt = ui.FS_GetFileList("saves", ".sav", s_savegame.listBuf, LISTBUFSIZE ); |
| 6527 | |
| 6528 | Cvar_Set("ui_ResumeOK", "0" ); |
| 6529 | holdChar = s_savegame.listBuf; |
| 6530 | for ( i = 0; i < fileCnt; i++ ) |
| 6531 | { |
| 6532 | // strip extension |
| 6533 | len = strlen( holdChar ); |
| 6534 | holdChar[len-4] = '\0'; |
| 6535 | |
| 6536 | if ( Q_stricmp("current",holdChar)!=0 ) |
| 6537 | { |
| 6538 | time_t result; |
| 6539 | if (Q_stricmp("auto",holdChar)==0) |
| 6540 | { |
| 6541 | Cvar_Set("ui_ResumeOK", "1" ); |
| 6542 | } |
| 6543 | else |
| 6544 | { // Is this a valid file??? & Get comment of file |
| 6545 | result = ui.SG_GetSaveGameComment(holdChar, s_savedata[s_savegame.saveFileCnt].currentSaveFileComments, s_savedata[s_savegame.saveFileCnt].currentSaveFileMap); |
| 6546 | if (result != 0) // ignore Bad save game |
| 6547 | { |
| 6548 | s_savedata[s_savegame.saveFileCnt].currentSaveFileName = holdChar; |
| 6549 | s_savedata[s_savegame.saveFileCnt].currentSaveFileDateTime = result; |
| 6550 | |
| 6551 | struct tm *localTime; |
| 6552 | localTime = localtime( &result ); |
| 6553 | strcpy(s_savedata[s_savegame.saveFileCnt].currentSaveFileDateTimeString,asctime( localTime ) ); |
| 6554 | s_savegame.saveFileCnt++; |
| 6555 | if (s_savegame.saveFileCnt == MAX_SAVELOADFILES) |
| 6556 | { |
| 6557 | break; |
| 6558 | } |
| 6559 | } |
| 6560 | } |
| 6561 | } |
| 6562 | |
| 6563 | holdChar += len + 1; //move to next item |
| 6564 | } |
| 6565 | |
| 6566 | qsort( s_savedata, s_savegame.saveFileCnt, sizeof(savedata_t), UI_SortSaveGames ); |
no test coverage detected