diff SaveLoad.cpp @ 1205:8c02e6f74b29

arrays to std::arrays phase 2 - mm7_data.h converted
author Grumpy7
date Sun, 09 Jun 2013 00:30:48 +0200
parents 0dbf6c4dd029
children ab6560001f5b
line wrap: on
line diff
--- a/SaveLoad.cpp	Sat Jun 08 21:47:29 2013 +0200
+++ b/SaveLoad.cpp	Sun Jun 09 00:30:48 2013 +0200
@@ -66,8 +66,8 @@
   for (uint i = 1; i < 5; ++i)
     for (uint j = 1; j < 6; ++j)
     {
-      sprintf(pTmpBuf, "data\\lloyd%d%d.pcx", i, j);
-      remove(pTmpBuf);
+      sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j);
+      remove(pTmpBuf.data());
     }
 
 
@@ -89,10 +89,10 @@
         }
     }
 
-  sprintf(pTmpBuf, "saves\\%s", pSavegameList->pFileList[uSlot].pSaveFileName);
+  sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[uSlot].pSaveFileName);
 
   pNew_LOD->CloseWriteFile();
-  if (!CopyFileA(pTmpBuf, "data\\new.lod", 0))
+  if (!CopyFileA(pTmpBuf.data(), "data\\new.lod", 0))
     int e = GetLastError();
 
   pNew_LOD->LoadFile("data\\new.lod", 0);
@@ -206,15 +206,15 @@
   pEventTimer->StopGameTime();
 
   v25 = pGames_LOD->DoesContainerExist(header.pLocationName);
-  sprintf(pTmpBuf, "levels\\%s", header.pLocationName);
-  v26 = _access(pTmpBuf, 4) != -1;
+  sprintf(pTmpBuf.data(), "levels\\%s", header.pLocationName);
+  v26 = _access(pTmpBuf.data(), 4) != -1;
   if ( !v25 && !v26 )
   {
-    sprintf(pTmpBuf, "Unable to find: %s!", header.pLocationName);
-    Abortf(pTmpBuf);
+    sprintf(pTmpBuf.data(), "Unable to find: %s!", header.pLocationName);
+    Abortf(pTmpBuf.data());
   }
 
-  strcpy(pCurrentMapName, header.pLocationName);
+  strcpy(pCurrentMapName.data(), header.pLocationName);
   dword_6BE364_game_settings_1 |= 0x2001;
 
   for (uint i = 0; i < uNumSavegameFiles; ++i)
@@ -259,8 +259,8 @@
   unsigned int compressed_block_size; // [sp+260h] [bp-10h]@23
  
   //v66 = a2;
-  strcpy(byte_6BE3B0, pCurrentMapName);
-  if (!_stricmp(pCurrentMapName, "d05.blv")) // arena
+  strcpy(byte_6BE3B0.data(), pCurrentMapName.data());
+  if (!_stricmp(pCurrentMapName.data(), "d05.blv")) // arena
     return;
 
   uncompressed_buff = (char*)malloc(1000000);
@@ -310,7 +310,7 @@
   memset(save_header.pName, 0, 20);
   memset(save_header.pLocationName, 0, 20);
   memset(save_header.field_30, 0, 52);
-  strcpy(save_header.pLocationName, pCurrentMapName);
+  strcpy(save_header.pLocationName, pCurrentMapName.data());
   save_header.uWordTime = pParty->uTimePlayed;
   strcpy(pLodDirectory.pFilename, "header.bin");
   pLodDirectory.uDataSize = sizeof(SavegameHeader);
@@ -483,7 +483,7 @@
       memcpy(data_write_pos, &pOutdoor->loc_time, 0x38);
       data_write_pos += 56;
     }
-    strcpy(Source, pCurrentMapName);
+    strcpy(Source, pCurrentMapName.data());
     _splitpath(Source, Drive, Dir, Filename, Ext);
    
     Size = (int)data_write_pos - (int)uncompressed_buff;
@@ -539,20 +539,20 @@
 
   //v1 = uSlot;
   //v6 = uSlot;
-  bNotArena = _stricmp(pCurrentMapName, "d05.blv");
+  bNotArena = _stricmp(pCurrentMapName.data(), "d05.blv");
   if ( bNotArena )
   {
     LOD::Directory pDir; // [sp+Ch] [bp-28h]@2
     SaveGame(0, 0);
     //v2 = 100 * v1;
-    strcpy(pSavegameHeader[uSlot].pLocationName, pCurrentMapName);
+    strcpy(pSavegameHeader[uSlot].pLocationName, pCurrentMapName.data());
     pSavegameHeader[uSlot].uWordTime = pParty->uTimePlayed;
     strcpy(pDir.pFilename, "header.bin");
     pDir.uDataSize = 100;
     pNew_LOD->Write(&pDir, &pSavegameHeader[uSlot], 0);
-    sprintf(pTmpBuf, "saves\\save%03d.mm7", uSlot);
+    sprintf(pTmpBuf.data(), "saves\\save%03d.mm7", uSlot);
     pNew_LOD->CloseWriteFile();
-    CopyFileA("data\\new.lod", pTmpBuf, 0);
+    CopyFileA("data\\new.lod", pTmpBuf.data(), 0);
   }
   GUI_UpdateWindows();
   pGUIWindow_CurrentMenu->Release();
@@ -597,14 +597,14 @@
 
     for (uint i = 0; i < 40; ++i)
     {
-      sprintf(pTmpBuf, "save%03d.mm7", i);
-      if (_access(pTmpBuf, 0) == -1)
+      sprintf(pTmpBuf.data(), "save%03d.mm7", i);
+      if (_access(pTmpBuf.data(), 0) == -1)
         continue;
 
       uint idx = i;
       if (!bHideEmptySlots)
         idx = uNumSavegameFiles;
-      strcpy(pSavegameList->pFileList[idx].pSaveFileName, pTmpBuf);
+      strcpy(pSavegameList->pFileList[idx].pSaveFileName, pTmpBuf.data());
 
       ++uNumSavegameFiles;
     }