mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Merged from revision: 7163
Externalized keys and locks to xml (by anv) - Locks (TableData/Items/Locks.xml): Originally 64 locks were kept in BinaryData/LOCKS.BIN. Now up to 255 locks can be specified in TableData/Locks.xml. If it isn't found, LOCKS.BIN will be loaded normally. - Keys (TableData/Items/Keys.xml): Originally 10 keys were hardcoded in KeyTable[]. Now up to 255 keys can be specified in TableData/Keys.xml. If it isn't found, hardcoded array will be used normally. see: http://www.bears-pit.com/board/ubbthreads.php/topics/331900.html git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7164 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+19
-7
@@ -41,6 +41,7 @@
|
||||
#include "GameSettings.h" // added by SANDRO
|
||||
#endif
|
||||
|
||||
#include "GameVersion.h"
|
||||
|
||||
DOOR_STATUS *gpDoorStatus = NULL;
|
||||
UINT8 gubNumDoorStatus=0;
|
||||
@@ -137,7 +138,7 @@ BOOLEAN LoadLockTable( void )
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
uiBytesToRead = sizeof( LOCK ) * NUM_LOCKS;
|
||||
uiBytesToRead = sizeof( LOCK ) * NUM_LOCKS_OLD;
|
||||
FileRead( hFile, LockTable, uiBytesToRead, &uiNumBytesRead );
|
||||
|
||||
FileClose( hFile );
|
||||
@@ -2040,16 +2041,27 @@ BOOLEAN SaveKeyTableToSaveGameFile( HWFILE hFile )
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
BOOLEAN LoadKeyTableFromSaveedGameFile( HWFILE hFile )
|
||||
BOOLEAN LoadKeyTableFromSaveedGameFile( HWFILE hFile, UINT32 uiSaveGameVersion )
|
||||
{
|
||||
UINT32 uiNumBytesRead=0;
|
||||
|
||||
|
||||
// Load the KeyTable
|
||||
FileRead( hFile, KeyTable, sizeof( KEY ) * NUM_KEYS, &uiNumBytesRead );
|
||||
if( uiNumBytesRead != sizeof( KEY ) * NUM_KEYS )
|
||||
if( uiSaveGameVersion < MORE_LOCKS_AND_KEYS )
|
||||
{
|
||||
return( FALSE );
|
||||
// Load the KeyTable
|
||||
FileRead( hFile, KeyTable, sizeof( KEY ) * NUM_KEYS_OLD, &uiNumBytesRead );
|
||||
if( uiNumBytesRead != sizeof( KEY ) * NUM_KEYS_OLD )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load the KeyTable
|
||||
FileRead( hFile, KeyTable, sizeof( KEY ) * NUM_KEYS, &uiNumBytesRead );
|
||||
if( uiNumBytesRead != sizeof( KEY ) * NUM_KEYS )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
return( TRUE );
|
||||
|
||||
Reference in New Issue
Block a user