From 6c97202aa36ef1b308c5a7d5312eeaa0b7fb4a12 Mon Sep 17 00:00:00 2001 From: ac-stef Date: Mon, 7 Sep 2015 12:25:09 +0200 Subject: [PATCH] retry mapmodel downloads Mapmodels which were not found once are put on a list and not tried to be loaded again. With this commit, the list is cleared during a map load if autodownload is enabled. This causes all missing models to be downloaded. Fixes issues with manually aborted autodownloads. --- source/src/protos.h | 1 + source/src/rendermodel.cpp | 6 ++++++ source/src/worldio.cpp | 1 + 3 files changed, 8 insertions(+) diff --git a/source/src/protos.h b/source/src/protos.h index 2b24d423..d06e83c2 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -801,6 +801,7 @@ extern mapmodelinfo *getmminfo(int i); extern int findanim(const char *name); extern void loadskin(const char *dir, const char *altdir, Texture *&skin); extern model *loadmodel(const char *name, int i = -1, bool trydl = false); +extern void resetmdlnotfound(); extern void preload_playermodels(); extern void preload_entmodels(); extern void preload_hudguns(); diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 959001ca..058741d3 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -305,6 +305,12 @@ void cleanupmodels() enumerate(mdllookup, model *, m, m->cleanup()); } +void resetmdlnotfound() +{ + enumeratek(mdlnotfound, const char *, m, delstring(m)); + mdlnotfound.clear(); +} + void getmapmodelattributes(char *name, char *attr) { const char *res = NULL; diff --git a/source/src/worldio.cpp b/source/src/worldio.cpp index 9ff406c1..dcb4ee8f 100644 --- a/source/src/worldio.cpp +++ b/source/src/worldio.cpp @@ -818,6 +818,7 @@ bool load_world(char *mname) // still supports all map formats that have c2skeepalive(); watch.start(); + if(autodownload) resetmdlnotfound(); preload_mapmodels(autodownload ? true : false); int mdlloadtime = watch.elapsed();