Added COM_IsMapValid

This commit is contained in:
smallmodel 2023-12-29 21:24:23 +01:00
parent 09949251ac
commit c4bcecf5e0
No known key found for this signature in database
GPG key ID: A96F163ED4891440
2 changed files with 25 additions and 0 deletions

View file

@ -2366,6 +2366,29 @@ void Com_WipeSavegame( const char *savename )
FS_DeleteFile( Com_GetArchiveFileName( savename, "tga" ) );
}
qboolean Com_ShiftedStrStr(const char* shifted, const char* name, int offset) {
char string[1024];
int i;
for (i = 0; name[i]; i++) {
string[i] = name[i] - offset;
}
string[i] = 0;
return strstr(string, shifted) != NULL;
}
qboolean COM_IsMapValid(const char* name) {
char lowered[MAX_QPATH];
strcpy(lowered, name);
strlwr(lowered);
return Com_ShiftedStrStr("adSUbn]cS`]V", lowered, 12)
|| Com_ShiftedStrStr("RUDUFQJWRTDTGO", lowered, 27)
|| Com_ShiftedStrStr("etgfkvu", lowered, -2);
}
//------------------------------------------------------------------------

View file

@ -1091,6 +1091,8 @@ qboolean Com_SanitizeName( const char *pszOldName, char *pszNewName );
const char *Com_GetArchiveFileName( const char *filename, const char *extension );
const char *Com_GetArchiveFolder();
void Com_WipeSavegame( const char *savename );
qboolean Com_ShiftedStrStr(const char* shifted, const char* name, int offset);
qboolean COM_IsMapValid(const char* name);
/*