From d24bb86686ef6a460ca097a777f3e1bd08f58f76 Mon Sep 17 00:00:00 2001 From: SpaceViking Date: Fri, 15 Jun 2007 02:57:16 +0000 Subject: [PATCH] Update inventory arrays to be vectors. Add class for inventory. Change some structs that use inventories to classes to provide constructors, destructors, etc. Note that with this update all file operations should still be compatible with previous files. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@969 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/IMP Confirm.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index 8f871ebc..41bd2250 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -722,7 +722,9 @@ void WriteOutCurrentImpCharacter( INT32 iProfileId, STR fileName ) } // write out the profile itself - if (!FileWrite(hFile, &gMercProfiles[ iProfileId ], sizeof( MERCPROFILESTRUCT ), &uiBytesWritten)) + // WDS - Clean up inventory handling + gMercProfiles[ iProfileId ].CopyNewInventoryToOld(); + if (!FileWrite(hFile, &gMercProfiles[ iProfileId ], SIZEOF_MERCPROFILESTRUCT_POD, &uiBytesWritten)) { if (hFile) FileClose(hFile); @@ -794,11 +796,13 @@ BOOLEAN LoadImpCharacter( STR nickName ) LaptopSaveInfo.iIMPIndex = iProfileId; // read in the profile - if (!FileRead(hFile, &gMercProfiles[ iProfileId ] ,sizeof( MERCPROFILESTRUCT ), &uiBytesRead)) + // WDS - Clean up inventory handling + if (!FileRead(hFile, &gMercProfiles[ iProfileId ] , SIZEOF_MERCPROFILESTRUCT_POD, &uiBytesRead)) { DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); return FALSE; } + gMercProfiles[ iProfileId ].CopyOldInventoryToNew(); // close file FileClose(hFile);