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@971 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
SpaceViking
2007-06-15 03:00:15 +00:00
parent 1ff6f798c3
commit 2b59950880
21 changed files with 1006 additions and 105 deletions
+10 -7
View File
@@ -275,13 +275,14 @@ BOOLEAN LoadMercProfiles(void)
for(uiLoop=0; uiLoop< NUM_PROFILES; uiLoop++)
{
if( JA2EncryptedFileRead( fptr, &gMercProfiles[uiLoop], sizeof( MERCPROFILESTRUCT ), &uiNumBytesRead ) != 1)
// WDS - Clean up inventory handling
if( JA2EncryptedFileRead( fptr, &gMercProfiles[uiLoop], SIZEOF_MERCPROFILESTRUCT_POD, &uiNumBytesRead ) != 1)
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FAILED to Read Merc Profiles from File %d %s",uiLoop, pFileName) );
FileClose( fptr );
return(FALSE);
}
gMercProfiles[ uiLoop ].CopyOldInventoryToNew();
//if the Dialogue exists for the merc, allow the merc to be hired
if( DialogueDataFileExistsForProfile( (UINT8)uiLoop, 0, FALSE, NULL ) )
@@ -904,8 +905,9 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam )
// Remove him from the game!
InternalTacticalRemoveSoldier( ubID, FALSE );
// WDS - Clean up inventory handling
// Create a new one!
memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) );
MercCreateStruct.initialize();
MercCreateStruct.bTeam = ubTeam;
MercCreateStruct.ubProfile = pSoldier->ubProfile;
MercCreateStruct.bBodyType = pSoldier->ubBodyType;
@@ -1463,9 +1465,10 @@ SOLDIERTYPE * SwapLarrysProfiles( SOLDIERTYPE * pSoldier )
pNewProfile->bExplosivesDelta = gMercProfiles[ ubSrcProfile ].bExplosivesDelta;
*/
memcpy( pNewProfile->bInvStatus, gMercProfiles[ ubSrcProfile ].bInvStatus , sizeof( UINT8) * 19 );
memcpy( pNewProfile->bInvNumber, gMercProfiles[ ubSrcProfile ].bInvNumber , sizeof( UINT8) * 19 );
memcpy( pNewProfile->inv , gMercProfiles[ ubSrcProfile ].inv , sizeof( UINT16 ) * 19 );
// WDS - Clean up inventory handling
pNewProfile->bInvStatus = gMercProfiles[ ubSrcProfile ].bInvStatus;
pNewProfile->bInvNumber = gMercProfiles[ ubSrcProfile ].bInvNumber;
pNewProfile->inv = gMercProfiles[ ubSrcProfile ].inv;
memcpy( pNewProfile->bMercTownReputation , gMercProfiles[ ubSrcProfile ].bMercTownReputation , sizeof( UINT8 ) * 20 );
// remove face
@@ -1551,4 +1554,4 @@ BOOLEAN IsProfileIdAnAimOrMERCMerc( UINT8 ubProfileID )
}
return( FALSE );
}
}