From 643171ed160f029d1b4efa618397e3c2650d9daa Mon Sep 17 00:00:00 2001 From: James Antill Date: Tue, 4 Mar 2003 07:26:29 +0000 Subject: [PATCH] Possibly fix the new sendfield algo. to match the old one. --- src/tetrinet.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/tetrinet.c b/src/tetrinet.c index 503eadd..f5b8e6d 100644 --- a/src/tetrinet.c +++ b/src/tetrinet.c @@ -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 ++) -- 2.50.1