]> hydra-www.ietfng.org Git - gtetrinet/commitdiff
Put a warning in if blocks are out of range.
authorJames Antill <james@src.gnome.org>
Mon, 3 Mar 2003 20:30:03 +0000 (20:30 +0000)
committerJames Antill <james@src.gnome.org>
Mon, 3 Mar 2003 20:30:03 +0000 (20:30 +0000)
* src/tetrinet.c (tetrinet_sendfield): Put a warning in if blocks are
out of range.

ChangeLog
src/tetrinet.c

index b0c32a805e28dba18c15acfc8f5ff71595881711..d1fddf886ff897c7a7ccd3d65775e9b22dba20cd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-03  James Antill  <james@and.org>
+
+       * src/tetrinet.c (tetrinet_sendfield): Put a warning in if blocks are
+       out of range.
+
 2003-02-24  Dani Carbonell  <bocata@panete.net>
 
        * src/partyline.c (stop_list): list_issued is a integer, changed
index 59942c1ba129219f8fc69fdad6412e8db4c5f8ba..52d73cedc2258c523056f74362b9683a0680a8cb 100644 (file)
@@ -864,7 +864,7 @@ void tetrinet_changeteam (const char *newteam)
 
 void tetrinet_sendfield (int reset)
 {
-  int x, y, i, d = FALSE; /* d is the number of differences */
+  int x, y, i, d = 0; /* d is the number of differences */
   char buf[1024], *p;
 
   char diff_buf[15][(FIELDWIDTH + 1)* FIELDHEIGHT * 2] = {0};
@@ -880,6 +880,12 @@ void tetrinet_sendfield (int reset)
 
        const int block = fields[playernum][y][x];
 
+        if ((block < 0) || (block >= 15))
+        {
+          g_warning("sendfield shouldn't reach here, block=%d\n", block);
+          continue;
+        }
+        
        if (block != sentfield[y][x]) {
          diff_buf[block][row_count[block]++] = x + '3';
          diff_buf[block][row_count[block]++] = y + '3';