From cc8121066aec011c842312a61cf00aa9f95901f0 Mon Sep 17 00:00:00 2001 From: sireus Date: Wed, 10 Oct 2012 18:31:44 +0000 Subject: [PATCH] cache missing models (otherwise, it would try to load them over and over again) git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6914 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/rendermodel.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index f6949910..43312743 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -101,6 +101,7 @@ COMMAND(mapmodel, "iiiss"); COMMAND(mapmodelreset, ""); hashtable mdllookup; +model *nomodel = NULL; model *loadmodel(const char *name, int i) { @@ -131,10 +132,17 @@ model *loadmodel(const char *name, int i) } } popscontext(); - if(!loadingmodel) return NULL; + if(!loadingmodel) + { + conoutf(_("failed to load model %s"), name); + if(!nomodel) nomodel = new md2("nomodel"); + m = nomodel; + mdllookup.access(newstring(name), m); + } + else mdllookup.access(m->name(), m); loadingmodel = NULL; - mdllookup.access(m->name(), m); } + if(m == nomodel) return NULL; if(mapmodels.inrange(i) && !mapmodels[i].m) mapmodels[i].m = m; return m; }