mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-19 08:29:44 +01:00
engine: client: implement map CRC32 checking on client side
This commit is contained in:
parent
ea24b5f3ca
commit
0de0615eeb
@ -21,6 +21,7 @@ GNU General Public License for more details.
|
||||
#include "shake.h"
|
||||
#include "hltv.h"
|
||||
#include "input.h"
|
||||
#include "server.h"
|
||||
#if XASH_LOW_MEMORY != 2
|
||||
int CL_UPDATE_BACKUP = SINGLEPLAYER_BACKUP;
|
||||
#endif
|
||||
@ -848,8 +849,10 @@ CL_ParseServerData
|
||||
void CL_ParseServerData( sizebuf_t *msg, qboolean legacy )
|
||||
{
|
||||
char gamefolder[MAX_QPATH];
|
||||
string mapfile;
|
||||
qboolean background;
|
||||
int i;
|
||||
uint32_t mapCRC;
|
||||
|
||||
HPAK_CheckSize( CUSTOM_RES_PATH );
|
||||
|
||||
@ -912,6 +915,18 @@ void CL_ParseServerData( sizebuf_t *msg, qboolean legacy )
|
||||
}
|
||||
}
|
||||
|
||||
Q_snprintf( mapfile, sizeof( mapfile ), "maps/%s.bsp", clgame.mapname );
|
||||
if( CRC32_MapFile( &mapCRC, mapfile, cl.maxclients > 1 ))
|
||||
{
|
||||
// validate map checksum
|
||||
if( mapCRC != cl.checksum )
|
||||
{
|
||||
Con_Printf( S_ERROR "Your map [%s] differs from the server's.\n", clgame.mapname );
|
||||
CL_Disconnect_f(); // for local game, call EndGame
|
||||
Host_AbortCurrentFrame(); // to avoid svc_bad
|
||||
}
|
||||
}
|
||||
|
||||
if( clgame.maxModels > MAX_MODELS )
|
||||
Con_Printf( S_WARN "server model limit is above client model limit %i > %i\n", clgame.maxModels, MAX_MODELS );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user