[nexuiz-commits] r7621 - in trunk/data/qcsrc: client server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Sep 4 02:45:19 EDT 2009


Author: div0
Date: 2009-09-04 02:45:19 -0400 (Fri, 04 Sep 2009)
New Revision: 7621

Modified:
   trunk/data/qcsrc/client/Main.qc
   trunk/data/qcsrc/server/scores.qc
Log:
hm... if we start networking score items as long if needed... we can make them just a char if in -128..127. Saves lots of bytes im DM, costs a little in balanced CTF matches (as the "score" column gets >127 for good players), saves a bit in unbalanced CTF matches, i.e. if there is only one player >127 :P

This will also help debugging the networking of the change, as it now ACTUALLY happens that scores get transmitted as long.


Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc	2009-09-03 23:23:30 UTC (rev 7620)
+++ trunk/data/qcsrc/client/Main.qc	2009-09-04 06:45:19 UTC (rev 7621)
@@ -632,7 +632,7 @@
 			if(lf & p)
 				o.(scores[i]) = ReadLong();
 			else
-				o.(scores[i]) = ReadShort();
+				o.(scores[i]) = ReadChar();
 		}
 
 	if(o.sort_prev)
@@ -664,7 +664,7 @@
 			if(lf & p)
 				o.(teamscores[i]) = ReadLong();
 			else
-				o.(teamscores[i]) = ReadShort();
+				o.(teamscores[i]) = ReadChar();
 		}
 
 	Sbar_UpdateTeamPos(o);

Modified: trunk/data/qcsrc/server/scores.qc
===================================================================
--- trunk/data/qcsrc/server/scores.qc	2009-09-03 23:23:30 UTC (rev 7620)
+++ trunk/data/qcsrc/server/scores.qc	2009-09-04 06:45:19 UTC (rev 7621)
@@ -56,7 +56,7 @@
 
 	longflags = 0;
 	for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
-		if(self.teamscores[i] > 32767 || self.teamscores[i] <= -32768)
+		if(self.teamscores[i] > 127 || self.teamscores[i] <= -128)
 			longflags |= p;
 
 #if MAX_TEAMSCORE <= 8
@@ -72,7 +72,7 @@
 			if(longflags & p)
 				WriteLong(MSG_ENTITY, self.teamscores[i]);
 			else
-				WriteShort(MSG_ENTITY, self.teamscores[i]);
+				WriteChar(MSG_ENTITY, self.teamscores[i]);
 		}
 
 	return TRUE;
@@ -216,7 +216,7 @@
 
 	longflags = 0;
 	for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
-		if(self.scores[i] > 32767 || self.scores[i] <= -32768)
+		if(self.scores[i] > 127 || self.scores[i] <= -128)
 			longflags |= p;
 
 #if MAX_SCORE <= 8
@@ -232,7 +232,7 @@
 			if(longflags & p)
 				WriteLong(MSG_ENTITY, self.scores[i]);
 			else
-				WriteShort(MSG_ENTITY, self.scores[i]);
+				WriteChar(MSG_ENTITY, self.scores[i]);
 		}
 
 	return TRUE;



More information about the nexuiz-commits mailing list