Mercurial > mm7
changeset 2178:43175acce099
savegame fix
author | Ritor1 |
---|---|
date | Wed, 22 Jan 2014 00:05:10 +0600 |
parents | e1199b655710 |
children | f0b5ca2dfb73 |
files | LOD.cpp SaveLoad.cpp |
diffstat | 2 files changed, 11 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/LOD.cpp Tue Jan 21 18:45:00 2014 +0600 +++ b/LOD.cpp Wed Jan 22 00:05:10 2014 +0600 @@ -1460,7 +1460,6 @@ return true; } - //----- (00461F1E) -------------------------------------------------------- int LODWriteableFile::CreateTempFile() { @@ -1478,8 +1477,6 @@ return 5; } - - //----- (00461EE9) -------------------------------------------------------- void LODWriteableFile::CloseWriteFile() { @@ -1543,7 +1540,7 @@ return 4; } else - bRewrite_data=true; + bRewrite_data = true; break; } if ( a4 == 2 ) @@ -1584,13 +1581,13 @@ Lindx.uDataSize = total_data_size; uNumSubDirs = Lindx.uNumSubIndices; //move indexes +1 after insert point - if ( !bRewrite_data && (insert_index < uNumSubDirs) ) + if ( !bRewrite_data && (insert_index < uNumSubDirs) )//перезаписывание файлов для освобождения места для нового ф-ла { for( int i = uNumSubDirs; i > insert_index; --i ) - memcpy(&pSubIndices[i], &pSubIndices[i - 1], sizeof(LOD::Directory)); + memcpy(&pSubIndices[i], &pSubIndices[i - 1], sizeof(LOD::Directory)); } //insert - memcpy(&pSubIndices[insert_index], pDir, sizeof(LOD::Directory)); + memcpy(&pSubIndices[insert_index], pDir, sizeof(LOD::Directory));//записать текущий файл //correct offsets to data if (uNumSubDirs > 0) {
--- a/SaveLoad.cpp Tue Jan 21 18:45:00 2014 +0600 +++ b/SaveLoad.cpp Wed Jan 22 00:05:10 2014 +0600 @@ -442,16 +442,16 @@ } memcpy(data_write_pos, &uNumActors, 4); data_write_pos += 4; - memcpy(data_write_pos, pActors.data(), 836 * uNumActors); - data_write_pos += 836 * uNumActors; + memcpy(data_write_pos, &pActors, uNumActors * sizeof(Actor)); + data_write_pos += uNumActors * sizeof(Actor); memcpy(data_write_pos, &uNumSpriteObjects, 4); data_write_pos += 4; - memcpy(data_write_pos, pSpriteObjects.data(), 112 * uNumSpriteObjects); - data_write_pos += 112 * uNumSpriteObjects; + memcpy(data_write_pos, &pSpriteObjects, uNumSpriteObjects * sizeof(SpriteObject)); + data_write_pos += uNumSpriteObjects * sizeof(SpriteObject); memcpy(data_write_pos, &uNumChests, 4); data_write_pos += 4; memcpy(data_write_pos, pChests.data(), sizeof(Chest)* uNumChests); - data_write_pos += sizeof(Chest)* uNumChests; + data_write_pos += sizeof(Chest) * uNumChests; memcpy(data_write_pos, &stru_5E4C90_MapPersistVars, 0xC8); data_write_pos += 200; memcpy(data_write_pos, &pOutdoor->loc_time, 0x38); @@ -459,6 +459,7 @@ } strcpy(Source, pCurrentMapName); _splitpath(Source, Drive, Dir, Filename, Ext); + Ext[1] = 'd'; Size = (int)data_write_pos - (int)uncompressed_buff; compressed_block_size = 999984; @@ -534,20 +535,10 @@ } // 4E28F8: using guessed type int pCurrentScreen; - - - - - - - - - - //----- (0045E297) -------------------------------------------------------- void SavegameList::Initialize(unsigned int bHideEmptySlots) { - memset(pSavegameList, 0, 0x3138); + memset(pSavegameList, 0, sizeof(pSavegameList)); // Reset(); uNumSavegameFiles = 0;