From: havoc Date: Mon, 24 Oct 2005 04:22:16 +0000 (+0000) Subject: slightly optimized Mod_ForName to make less calls to Mod_LoadModel X-Git-Tag: xonotic-v0.1.0preview~4521 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=372bf8402292c7ac2853031808d751803d2433ef;p=xonotic%2Fdarkplaces.git slightly optimized Mod_ForName to make less calls to Mod_LoadModel git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5763 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_shared.c b/model_shared.c index 0fee3712..e100139c 100644 --- a/model_shared.c +++ b/model_shared.c @@ -163,7 +163,8 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean checkdisk, qboolea Con_DPrintf("loading model %s\n", mod->name); // LordHavoc: unload the existing model in this slot (if there is one) - Mod_UnloadModel(mod); + if (mod->loaded) + Mod_UnloadModel(mod); // load the model mod->isworldmodel = isworldmodel; @@ -322,7 +323,7 @@ model_t *Mod_ForName(const char *name, qboolean crash, qboolean checkdisk, qbool { model_t *model; model = Mod_FindName(name); - if (!model->loaded || checkdisk) + if (model->name[0] != '*' && (!model->loaded || checkdisk)) Mod_LoadModel(model, crash, checkdisk, isworldmodel); return model; }