]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use autocvars for the per-team player models/skins, speedup for a slow function
authorMario <mario@smbclan.net>
Tue, 7 Mar 2017 13:06:02 +0000 (23:06 +1000)
committerMario <mario@smbclan.net>
Tue, 7 Mar 2017 13:06:02 +0000 (23:06 +1000)
qcsrc/server/autocvars.qh
qcsrc/server/client.qc

index c5c844e918cc4f23986b4eef5eb1d724fb2b61d8..85b767fc91a0a9a2076aaa19b58af288ed634d4f 100644 (file)
@@ -282,6 +282,10 @@ bool autocvar_sv_curl_serverpackages_auto;
 bool autocvar_sv_db_saveasdump;
 bool autocvar_sv_defaultcharacter;
 bool autocvar_sv_defaultcharacterskin;
+int autocvar_sv_defaultplayerskin_blue;
+int autocvar_sv_defaultplayerskin_pink;
+int autocvar_sv_defaultplayerskin_red;
+int autocvar_sv_defaultplayerskin_yellow;
 string autocvar_sv_defaultplayercolors;
 string autocvar_sv_defaultplayermodel;
 string autocvar_sv_defaultplayermodel_blue;
index 0e84ec82477f3fba3e39851debcb62bc3cf13d8e..ddbf0fd1c76d089a6b881c10011d344de7b3c3bc 100644 (file)
@@ -383,11 +383,12 @@ void FixPlayermodel(entity player)
        {
                if(teamplay)
                {
-                       string s = Static_Team_ColorName_Lower(player.team);
-                       if (s != "neutral")
+                       switch(player.team)
                        {
-                               defaultmodel = cvar_string(strcat("sv_defaultplayermodel_", s));
-                               defaultskin = cvar(strcat("sv_defaultplayerskin_", s));
+                               case NUM_TEAM_1: defaultmodel = autocvar_sv_defaultplayermodel_red; defaultskin = autocvar_sv_defaultplayerskin_red; break;
+                               case NUM_TEAM_2: defaultmodel = autocvar_sv_defaultplayermodel_blue; defaultskin = autocvar_sv_defaultplayerskin_blue; break;
+                               case NUM_TEAM_3: defaultmodel = autocvar_sv_defaultplayermodel_yellow; defaultskin = autocvar_sv_defaultplayerskin_yellow; break;
+                               case NUM_TEAM_4: defaultmodel = autocvar_sv_defaultplayermodel_pink; defaultskin = autocvar_sv_defaultplayerskin_pink; break;
                        }
                }
 
@@ -418,9 +419,13 @@ void FixPlayermodel(entity player)
        {
                if(teamplay)
                {
-                       string s = Static_Team_ColorName_Lower(player.team);
-                       if (s != "neutral")
-                               defaultskin = cvar(strcat("sv_defaultplayerskin_", s));
+                       switch(player.team)
+                       {
+                               case NUM_TEAM_1: defaultskin = autocvar_sv_defaultplayerskin_red; break;
+                               case NUM_TEAM_2: defaultskin = autocvar_sv_defaultplayerskin_blue; break;
+                               case NUM_TEAM_3: defaultskin = autocvar_sv_defaultplayerskin_yellow; break;
+                               case NUM_TEAM_4: defaultskin = autocvar_sv_defaultplayerskin_pink; break;
+                       }
                }
 
                if(!defaultskin)