2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-02-27 05:51:10 +03:00

Check limits up to MAX_MODELS for precached local models (Related #633)

This commit is contained in:
s1lent 2018-08-08 14:06:03 +07:00
parent 4da8c9ebcd
commit 3eed9d11e7
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C

View File

@ -283,16 +283,19 @@ char *ED_ParseEdict(char *data, edict_t *ent)
} }
int index = Q_atoi(com_token + 1); int index = Q_atoi(com_token + 1);
if (i == MAX_MODELS)
{
Host_Error("%s: Model '%s' failed to precache because the item count is over the %d limit.\n"
"Reduce the number of brush models and/or regular models in the map to correct this.", __func__,
localmodels[index], MAX_MODELS);
}
g_psv.model_precache[i] = localmodels[index]; g_psv.model_precache[i] = localmodels[index];
g_psv.models[i] = Mod_ForName(localmodels[index], FALSE, FALSE); g_psv.models[i] = Mod_ForName(localmodels[index], FALSE, FALSE);
g_psv.model_precache_flags[i] |= RES_FATALIFMISSING; g_psv.model_precache_flags[i] |= RES_FATALIFMISSING;
#ifdef REHLDS_OPT_PEDANTIC #ifdef REHLDS_OPT_PEDANTIC
{ g_rehlds_sv.modelsMap.put(g_psv.model_precache[i], i);
int __itmp = i;
g_rehlds_sv.modelsMap.put(g_psv.model_precache[i], __itmp);
}
#endif #endif
} }
} }