]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
HUD: don't draw panels needing player data before it's received
authorbones_was_here <bones_was_here@xonotic.au>
Tue, 6 Aug 2024 05:14:09 +0000 (15:14 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Tue, 6 Aug 2024 05:14:09 +0000 (15:14 +1000)
Fixes
"client VM warning: VM_CL_getstati: index(-1) is >=MAX_CL_STATS(256) or <0"
often appearing when connecting, with my hud_panel_ammo config.

It could also have been fixed by checking for (ammoType == 0) as well as
(ammoType == RES_NONE) but a many-cases fix is better than a
special-case fix.

qcsrc/client/main.qc
qcsrc/client/main.qh

index e59300a7c706523cbc33d780209b9620c39daec7..95469177996192a69b767e9f1c7c9a6925caa8bd 100644 (file)
@@ -651,7 +651,7 @@ NET_HANDLE(ENT_CLIENT_TEAMSCORES, bool isnew)
 NET_HANDLE(ENT_CLIENT_CLIENTDATA, bool isnew)
 {
        make_pure(this);
-       float newspectatee_status;
+       int newspectatee_status;
 
        int f = ReadByte();
 
index d4d97dc831e95f7cafc99a2b935c1598e412d8fe..e7972edc4ad69dd4907e9ffd5b69eb11028a858e 100644 (file)
@@ -186,7 +186,7 @@ int binddb;
 // -1 - observing
 // 0 - playing
 // >0 - id of spectated player
-float spectatee_status;
+int spectatee_status = -1; ///< the -1 disables HUD panels before CSQC receives necessary data
 float spectatee_status_changed_time;
 
 #define player_currententnum (spectatee_status > 0 ? spectatee_status : player_localnum + 1)