Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2003:
[Freeciv-Dev] Re: (PR#3649) Network usage optimization
Home

[Freeciv-Dev] Re: (PR#3649) Network usage optimization

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: (PR#3649) Network usage optimization
From: "Arnstein Lindgard" <arnstein.lindgard@xxxxxxx>
Date: Fri, 7 Mar 2003 10:22:01 -0800
Reply-to: rt@xxxxxxxxxxxxxx

I wrote:
> The attached patch reduces the total bandwidth consumption of a
> typical Freeciv game with about 25%, just by editing 6 lines
> of serializing code.

Ouch, I forgot to add a new mandatory capstring
after modifying common/packets.c.

New patch.


Arnstein

diff -ruN -Xdiff_ignore cvs/common/capstr.c netoptimize1/common/capstr.c
--- cvs/common/capstr.c Tue Feb 18 15:52:11 2003
+++ netoptimize1/common/capstr.c        Fri Mar  7 19:17:54 2003
@@ -76,7 +76,7 @@
 
 #define CAPABILITY "+1.14.0 conn_info +occupied team tech_impr_gfx " \
                    "city_struct_minor_cleanup obsolete_last class_legend " \
-                   "+impr_req +waste +fastfocus +continent"
+                   "+impr_req +waste +fastfocus +continent +netopt1"
   
 /* "+1.14.0" is protocol for 1.14.0 release.
  *
diff -ruN -Xdiff_ignore cvs/common/packets.c netoptimize1/common/packets.c
--- cvs/common/packets.c        Tue Feb 18 15:52:19 2003
+++ netoptimize1/common/packets.c       Fri Mar  7 19:16:56 2003
@@ -875,9 +875,9 @@
 
   dio_put_uint32(&dout, pinfo->reputation);
   for (i = 0; i < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS; i++) {
-    dio_put_uint32(&dout, pinfo->diplstates[i].type);
-    dio_put_uint32(&dout, pinfo->diplstates[i].turns_left);
-    dio_put_uint32(&dout, pinfo->diplstates[i].has_reason_to_cancel);
+    dio_put_uint8(&dout, pinfo->diplstates[i].type);
+    dio_put_uint8(&dout, pinfo->diplstates[i].turns_left);
+    dio_put_uint8(&dout, pinfo->diplstates[i].has_reason_to_cancel);
   }
 
   dio_put_uint32(&dout, pinfo->gold);
@@ -932,9 +932,9 @@
 
   dio_get_uint32(&din, &pinfo->reputation);
   for (i = 0; i < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS; i++) {
-    dio_get_uint32(&din, (int *) &pinfo->diplstates[i].type);
-    dio_get_uint32(&din, &pinfo->diplstates[i].turns_left);
-    dio_get_uint32(&din, &pinfo->diplstates[i].has_reason_to_cancel);
+    dio_get_uint8(&din, (int *) &pinfo->diplstates[i].type);
+    dio_get_uint8(&din, &pinfo->diplstates[i].turns_left);
+    dio_get_uint8(&din, &pinfo->diplstates[i].has_reason_to_cancel);
   }
 
   dio_get_uint32(&din, &pinfo->gold);

[Prev in Thread] Current Thread [Next in Thread]