r3402 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Feb 23 07:44:55 EST 2008


Author: div0
Date: 2008-02-23 07:44:54 -0500 (Sat, 23 Feb 2008)
New Revision: 3402

Modified:
   trunk/data/qcsrc/server/ctf.qc
Log:
escaping \ to \xDC for DB


Modified: trunk/data/qcsrc/server/ctf.qc
===================================================================
--- trunk/data/qcsrc/server/ctf.qc	2008-02-22 22:44:45 UTC (rev 3401)
+++ trunk/data/qcsrc/server/ctf.qc	2008-02-23 12:44:54 UTC (rev 3402)
@@ -227,7 +227,7 @@
 	local float t;
 	local entity head;
 	local entity player;
-	local string s, s0, h0;
+	local string s, s0, h0, h1;
 	if (other.classname != "player")
 		return;
 	if (other.health < 1) // ignore dead players
@@ -249,23 +249,24 @@
 		s = ftos_decimals(t, 2);
 		s0 = ftos_decimals(flagcaptimerecord, 2);
 		h0 = db_get(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"));
-		if(h0 == other.netname)
+		h1 = strreplace(other.netname, "\\", "\xDC"); // h1: current netname, escaped for DB (\ is 5C, other \ is DC)
+		if(h0 == h1)
 			h0 = "his";
 		else
-			h0 = strcat(h0, "^7's"); 
+			h0 = strcat(strreplace(h0, "\xDC", "\\"), "^7's"); // h0: display text for previous netname
 		if (flagcaptimerecord == 0)
 		{
 			bprint(other.netname, "^7 captured the ", other.flagcarried.netname, " in ", s, " seconds\n");
 			flagcaptimerecord = t;
 			db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time"), ftos(t));
-			db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"), other.netname);
+			db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"), h1);
 		}
 		else if (t < flagcaptimerecord)
 		{
 			bprint(other.netname, "^7 captured the ", other.flagcarried.netname, " in ", s, ", breaking ", strcat(h0, " previous record of ", s0, " seconds\n"));
 			flagcaptimerecord = t;
 			db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time"), ftos(t));
-			db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"), other.netname);
+			db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"), h1);
 		}
 		else
 		{




More information about the nexuiz-commits mailing list