From: Mario Date: Mon, 12 Oct 2015 11:50:43 +0000 (+1000) Subject: Fix multi model support with sv_defaultplayermodel cvars X-Git-Tag: xonotic-v0.8.2~1838 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ebb994eff725e1636af6793135503de6f5293478;p=xonotic%2Fxonotic-data.pk3dir.git Fix multi model support with sv_defaultplayermodel cvars --- diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 4c8fdeaaf..88ca70248 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -967,6 +967,18 @@ void precache_all_playermodels(string pattern) search_end(globhandle); } +void precache_playermodels(string s) +{ + if(s != "") + { + int n = tokenize_console(s); + precache_playermodel(argv(0)); + + for (int i = 1; i < n; ++i) + precache_model(argv(i)); + } +} + void precache() {SELFPARAM(); // gamemode related things @@ -984,22 +996,11 @@ void precache() if (autocvar_sv_defaultcharacter) { - string s; - s = autocvar_sv_defaultplayermodel_red; - if (s != "") - precache_playermodel(s); - s = autocvar_sv_defaultplayermodel_blue; - if (s != "") - precache_playermodel(s); - s = autocvar_sv_defaultplayermodel_yellow; - if (s != "") - precache_playermodel(s); - s = autocvar_sv_defaultplayermodel_pink; - if (s != "") - precache_playermodel(s); - s = autocvar_sv_defaultplayermodel; - if (s != "") - precache_playermodel(s); + precache_playermodels(autocvar_sv_defaultplayermodel_red); + precache_playermodels(autocvar_sv_defaultplayermodel_blue); + precache_playermodels(autocvar_sv_defaultplayermodel_yellow); + precache_playermodels(autocvar_sv_defaultplayermodel_pink); + precache_playermodels(autocvar_sv_defaultplayermodel); } if (g_footsteps)