]> hydra-www.ietfng.org Git - gtetrinet/commitdiff
Possibly fix the new sendfield algo. to match the old one.
authorJames Antill <james@src.gnome.org>
Tue, 4 Mar 2003 07:26:29 +0000 (07:26 +0000)
committerJames Antill <james@src.gnome.org>
Tue, 4 Mar 2003 07:26:29 +0000 (07:26 +0000)
src/tetrinet.c

index 503eaddf0e3a7f90f5e439148e53a088bfb1b534..f5b8e6d0ee3648f2f613042b2647849e01582c34 100644 (file)
@@ -927,7 +927,7 @@ void tetrinet_sendfield (int reset)
   char diff_buf[15][(FIELDWIDTH + 1)* FIELDHEIGHT * 2] = {0};
 
   int row_count[15] = {1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1};
-
+  
   g_snprintf (buf, sizeof(buf), "%d ", playernum);
 
   if(!reset) {
@@ -950,10 +950,14 @@ void tetrinet_sendfield (int reset)
        }
       }
     }
-    if (d == 0) return; // no differences
-  }
+    if (d == 0) return; /* no differences */
 
-  if (reset || d >= FIELDHEIGHT*FIELDWIDTH) {
+    for (i = 0; i < 15; ++i)
+      if (row_count[i] > 1)
+        ++d; /* add an extra value for the '!'+i at the start */
+  }
+  
+  if (reset || d >= (FIELDHEIGHT*FIELDWIDTH)) {
     /* sending entire field is more efficient */
     p = buf + 2;
     for (y = 0; y < FIELDHEIGHT; y ++)