about summary refs log tree commit diff homepage
path: root/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'server.c')
-rwxr-xr-xserver.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/server.c b/server.c
index e96d3dd..8892d2d 100755
--- a/server.c
+++ b/server.c
@@ -54,7 +54,6 @@ static struct Client {
     uint32_t tileY;
     uint8_t cellX;
     uint8_t cellY;
-    uint8_t color;
 
     struct Client *prev;
     struct Client *next;
@@ -69,7 +68,6 @@ static struct Client *clientAdd(int fd) {
     client->tileY = TILE_INIT_Y;
     client->cellX = CELL_INIT_X;
     client->cellY = CELL_INIT_Y;
-    client->color = COLOR_WHITE;
 
     client->prev = NULL;
     if (clientHead) {
@@ -161,15 +159,15 @@ static bool clientMove(struct Client *client, int8_t dx, uint8_t dy) {
     return true;
 }
 
-static bool clientPut(struct Client *client, char cell) {
+static bool clientPut(struct Client *client, uint8_t color, char cell) {
     struct Tile *tile = tileGet(client->tileX, client->tileY);
-    tile->colors[client->cellY][client->cellX] = client->color;
+    tile->colors[client->cellY][client->cellX] = color;
     tile->cells[client->cellY][client->cellX] = cell;
 
     struct ServerMessage msg = { .type = SERVER_PUT };
     msg.data.p.cellX = client->cellX;
     msg.data.p.cellY = client->cellY;
-    msg.data.p.color = client->color;
+    msg.data.p.color = color;
     msg.data.p.cell = cell;
     return clientCast(client, &msg);
 }
@@ -259,12 +257,8 @@ int main() {
                 clientMove(client, msg.data.m.dx, msg.data.m.dy);
                 break;
 
-            case CLIENT_COLOR:
-                client->color = msg.data.c;
-                break;
-
             case CLIENT_PUT:
-                clientPut(client, msg.data.p);
+                clientPut(client, msg.data.p.color, msg.data.p.cell);
                 break;
 
             default:
l@eworm.de> 2018-09-11ui-log: ban strcpy()Christian Hesse Git upstream bans strcpy() with commit: automatically ban strcpy() c8af66ab8ad7cd78557f0f9f5ef6a52fd46ee6dd Signed-off-by: Christian Hesse <mail@eworm.de> 2018-09-11parsing: ban sprintf()Christian Hesse Git upstream bans sprintf() with commit: banned.h: mark sprintf() as banned cc8fdaee1eeaf05d8dd55ff11f111b815f673c58 Signed-off-by: Christian Hesse <mail@eworm.de> 2018-09-11parsing: ban strncpy()Christian Hesse Git upstream bans strncpy() with commit: banned.h: mark strncpy() as banned e488b7aba743d23b830d239dcc33d9ca0745a9ad Signed-off-by: Christian Hesse <mail@eworm.de> 2018-08-28filters: generate anchor links from markdownChristian Hesse This makes the markdown filter generate anchor links for headings. Signed-off-by: Christian Hesse <mail@eworm.de> Tested-by: jean-christophe manciot <actionmystique@gmail.com> 2018-08-03Bump version.Jason A. Donenfeld Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> 2018-08-03clone: fix directory traversalJason A. Donenfeld This was introduced in the initial version of this code, way back when in 2008. $ curl http://127.0.0.1/cgit/repo/objects/?path=../../../../../../../../../etc/passwd root:x:0:0:root:/root:/bin/sh ... Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Reported-by: Jann Horn <jannh@google.com> 2018-08-03config: record repo.snapshot-prefix in the per-repo configKonstantin Ryabitsev