Merge pull request #643 from s1lentq/master

Check limits up to MAX_MODELS for precached local models (Related #633)
This commit is contained in:
theAsmodai 2018-08-11 18:04:52 +03:00 committed by GitHub
commit 0ce0af7d0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -283,16 +283,19 @@ char *ED_ParseEdict(char *data, edict_t *ent)
}
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.models[i] = Mod_ForName(localmodels[index], FALSE, FALSE);
g_psv.model_precache_flags[i] |= RES_FATALIFMISSING;
#ifdef REHLDS_OPT_PEDANTIC
{
int __itmp = i;
g_rehlds_sv.modelsMap.put(g_psv.model_precache[i], __itmp);
}
g_rehlds_sv.modelsMap.put(g_psv.model_precache[i], i);
#endif
}
}