mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
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:
+20
-4
@@ -6409,11 +6409,19 @@ BOOLEAN SavePreRandomNumbersToSaveGameFile( HWFILE hFile )
|
||||
}
|
||||
|
||||
//Save the Prerandom number index
|
||||
FileWrite( hFile, guiPreRandomNums, sizeof( UINT32 ) * MAX_PREGENERATED_NUMS, &uiNumBytesWritten );
|
||||
if( uiNumBytesWritten != sizeof( UINT32 ) * MAX_PREGENERATED_NUMS )
|
||||
for (std::vector<UINT32>::iterator iter = guiPreRandomNums.begin();
|
||||
iter != guiPreRandomNums.end(); ++iter) {
|
||||
FileWrite( hFile, &*iter, sizeof( UINT32 ), &uiNumBytesWritten );
|
||||
if( uiNumBytesWritten != sizeof( UINT32 ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
}
|
||||
//FileWrite( hFile, guiPreRandomNums, sizeof( UINT32 ) * MAX_PREGENERATED_NUMS, &uiNumBytesWritten );
|
||||
//if( uiNumBytesWritten != sizeof( UINT32 ) * MAX_PREGENERATED_NUMS )
|
||||
//{
|
||||
// return( FALSE );
|
||||
//}
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -6430,11 +6438,19 @@ BOOLEAN LoadPreRandomNumbersFromSaveGameFile( HWFILE hFile )
|
||||
}
|
||||
|
||||
//Load the Prerandom number index
|
||||
FileRead( hFile, guiPreRandomNums, sizeof( UINT32 ) * MAX_PREGENERATED_NUMS, &uiNumBytesRead );
|
||||
if( uiNumBytesRead != sizeof( UINT32 ) * MAX_PREGENERATED_NUMS )
|
||||
for (std::vector<UINT32>::iterator iter = guiPreRandomNums.begin();
|
||||
iter != guiPreRandomNums.end(); ++iter) {
|
||||
FileRead( hFile, &*iter, sizeof( UINT32 ), &uiNumBytesRead );
|
||||
if( uiNumBytesRead != sizeof( UINT32 ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
}
|
||||
// FileRead( hFile, guiPreRandomNums, sizeof( UINT32 ) * MAX_PREGENERATED_NUMS, &uiNumBytesRead );
|
||||
// if( uiNumBytesRead != sizeof( UINT32 ) * MAX_PREGENERATED_NUMS )
|
||||
// {
|
||||
// return( FALSE );
|
||||
// }
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user