Change to use vector for pre-RNG array

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2792 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
SpaceViking
2009-05-02 05:44:25 +00:00
parent e1a56677f4
commit 3cb0624342
+20 -4
View File
@@ -6409,11 +6409,19 @@ BOOLEAN SavePreRandomNumbersToSaveGameFile( HWFILE hFile )
} }
//Save the Prerandom number index //Save the Prerandom number index
FileWrite( hFile, guiPreRandomNums, sizeof( UINT32 ) * MAX_PREGENERATED_NUMS, &uiNumBytesWritten ); for (std::vector<UINT32>::iterator iter = guiPreRandomNums.begin();
if( uiNumBytesWritten != sizeof( UINT32 ) * MAX_PREGENERATED_NUMS ) iter != guiPreRandomNums.end(); ++iter) {
FileWrite( hFile, &*iter, sizeof( UINT32 ), &uiNumBytesWritten );
if( uiNumBytesWritten != sizeof( UINT32 ) )
{ {
return( FALSE ); return( FALSE );
} }
}
//FileWrite( hFile, guiPreRandomNums, sizeof( UINT32 ) * MAX_PREGENERATED_NUMS, &uiNumBytesWritten );
//if( uiNumBytesWritten != sizeof( UINT32 ) * MAX_PREGENERATED_NUMS )
//{
// return( FALSE );
//}
return( TRUE ); return( TRUE );
} }
@@ -6430,11 +6438,19 @@ BOOLEAN LoadPreRandomNumbersFromSaveGameFile( HWFILE hFile )
} }
//Load the Prerandom number index //Load the Prerandom number index
FileRead( hFile, guiPreRandomNums, sizeof( UINT32 ) * MAX_PREGENERATED_NUMS, &uiNumBytesRead ); for (std::vector<UINT32>::iterator iter = guiPreRandomNums.begin();
if( uiNumBytesRead != sizeof( UINT32 ) * MAX_PREGENERATED_NUMS ) iter != guiPreRandomNums.end(); ++iter) {
FileRead( hFile, &*iter, sizeof( UINT32 ), &uiNumBytesRead );
if( uiNumBytesRead != sizeof( UINT32 ) )
{ {
return( FALSE ); return( FALSE );
} }
}
// FileRead( hFile, guiPreRandomNums, sizeof( UINT32 ) * MAX_PREGENERATED_NUMS, &uiNumBytesRead );
// if( uiNumBytesRead != sizeof( UINT32 ) * MAX_PREGENERATED_NUMS )
// {
// return( FALSE );
// }
return( TRUE ); return( TRUE );
} }