engine: client: implement map CRC32 checking on client side
This commit is contained in:
parent
ea24b5f3ca
commit
0de0615eeb
1 changed files with 15 additions and 0 deletions
|
@ -21,6 +21,7 @@ GNU General Public License for more details.
|
||||||
#include "shake.h"
|
#include "shake.h"
|
||||||
#include "hltv.h"
|
#include "hltv.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "server.h"
|
||||||
#if XASH_LOW_MEMORY != 2
|
#if XASH_LOW_MEMORY != 2
|
||||||
int CL_UPDATE_BACKUP = SINGLEPLAYER_BACKUP;
|
int CL_UPDATE_BACKUP = SINGLEPLAYER_BACKUP;
|
||||||
#endif
|
#endif
|
||||||
|
@ -848,8 +849,10 @@ CL_ParseServerData
|
||||||
void CL_ParseServerData( sizebuf_t *msg, qboolean legacy )
|
void CL_ParseServerData( sizebuf_t *msg, qboolean legacy )
|
||||||
{
|
{
|
||||||
char gamefolder[MAX_QPATH];
|
char gamefolder[MAX_QPATH];
|
||||||
|
string mapfile;
|
||||||
qboolean background;
|
qboolean background;
|
||||||
int i;
|
int i;
|
||||||
|
uint32_t mapCRC;
|
||||||
|
|
||||||
HPAK_CheckSize( CUSTOM_RES_PATH );
|
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 )
|
if( clgame.maxModels > MAX_MODELS )
|
||||||
Con_Printf( S_WARN "server model limit is above client model limit %i > %i\n", clgame.maxModels, MAX_MODELS );
|
Con_Printf( S_WARN "server model limit is above client model limit %i > %i\n", clgame.maxModels, MAX_MODELS );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue