diff --git a/neo/idlib/LangDict.cpp b/neo/idlib/LangDict.cpp index 63b477ae..f53e8bbf 100644 --- a/neo/idlib/LangDict.cpp +++ b/neo/idlib/LangDict.cpp @@ -100,8 +100,11 @@ bool idLangDict::Load( const char *fileName, bool clear /* _D3XP */ ) { idLangKeyValue kv; kv.key = tok; kv.value = tok2; - assert( kv.key.Cmpn( STRTABLE_ID, STRTABLE_ID_LENGTH ) == 0 ); - hash.Add( GetHashKey( kv.key ), args.Append( kv ) ); + // DG: D3LE has #font_ entries in english.lang, maybe from D3BFG? not supported here, just skip them + if(kv.key.Cmpn("#font_", 6) != 0) { + assert( kv.key.Cmpn( STRTABLE_ID, STRTABLE_ID_LENGTH ) == 0 ); + hash.Add( GetHashKey( kv.key ), args.Append( kv ) ); + } } } idLib::common->Printf( "%i strings read from %s\n", args.Num(), fileName ); @@ -303,8 +306,20 @@ idLangDict::GetHashKey */ int idLangDict::GetHashKey( const char *str ) const { int hashKey = 0; + // DG: Replace assertion for invalid entries with a warning that's shown only once + // (for D3LE mod that seems to have lots of entries like #str_adil_exis_pda_01_audio_info) + const char* strbk = str; + static bool warnedAboutInvalidKey = false; for ( str += STRTABLE_ID_LENGTH; str[0] != '\0'; str++ ) { - assert( str[0] >= '0' && str[0] <= '9' ); + // assert( str[0] >= '0' && str[0] <= '9' ); + if(!warnedAboutInvalidKey && (str[0] < '0' || str[0] > '9')) { + // The "hash" code here very obviously expects numbers, but apparently it still somehow works, + // so just warn about it and otherwise accept those entries, seems to work for D3LE? + idLib::common->Warning( "We have at least one invalid key in a language dict: %s\n" + " (might still work, but Doom3 really wants #str_01234, i.e. only a number after '#str_')\n", strbk ); + warnedAboutInvalidKey = true; + } + // DG end hashKey = hashKey * 10 + str[0] - '0'; } return hashKey;