fix header->ident handling

This commit is contained in:
Garux 2021-09-27 16:18:46 +03:00
parent 1b1e6769e8
commit 94cc88d8f4
2 changed files with 5 additions and 5 deletions

View File

@ -223,7 +223,7 @@ void LoadIBSPFile( const char *filename ){
SwapBlock( (int*) ( (byte*) header + 4 ), sizeof( *header ) - 4 );
/* make sure it matches the format we're trying to load */
if ( !force && (const int&) header->ident != (const int&) g_game->bspIdent ) {
if ( !force && memcmp( header->ident, g_game->bspIdent, 4 ) ) {
Error( "%s is not a %s file", filename, g_game->bspIdent );
}
if ( !force && header->version != g_game->bspVersion ) {
@ -277,7 +277,7 @@ void PartialLoadIBSPFile( const char *filename ){
SwapBlock( (int*) ( (byte*) header + 4 ), sizeof( *header ) - 4 );
/* make sure it matches the format we're trying to load */
if ( !force && (const int&) header->ident != (const int&) g_game->bspIdent ) {
if ( !force && memcmp( header->ident, g_game->bspIdent, 4 ) ) {
Error( "%s is not a %s file", filename, g_game->bspIdent );
}
if ( !force && header->version != g_game->bspVersion ) {
@ -305,7 +305,7 @@ void WriteIBSPFile( const char *filename ){
//% Swapfile();
/* set up header */
(int&) header.ident = (const int&) g_game->bspIdent;
memcpy( header.ident, g_game->bspIdent, 4 );
header.version = LittleLong( g_game->bspVersion );
/* write initial header */

View File

@ -189,7 +189,7 @@ void LoadRBSPFile( const char *filename ){
SwapBlock( (int*) ( (byte*) header + 4 ), sizeof( *header ) - 4 );
/* make sure it matches the format we're trying to load */
if ( !force && (const int&) header->ident != (const int&) g_game->bspIdent ) {
if ( !force && memcmp( header->ident, g_game->bspIdent, 4 ) ) {
Error( "%s is not a %s file", filename, g_game->bspIdent );
}
if ( !force && header->version != g_game->bspVersion ) {
@ -232,7 +232,7 @@ void WriteRBSPFile( const char *filename ){
//% Swapfile();
/* set up header */
(int&) header.ident = (const int&) g_game->bspIdent;
memcpy( header.ident, g_game->bspIdent, 4 );
header.version = LittleLong( g_game->bspVersion );
/* write initial header */