summary refs log tree commit diff homepage
path: root/client.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-04-09 01:25:43 -0400
committerJune McEnroe <june@causal.agency>2018-04-09 01:25:43 -0400
commitd5d7c11a43941f51b7fcbc7614fc81fb6cc8d883 (patch)
treefb57f6052a242445f975536ff5c1ec60020074a5 /client.c
parentReplace #define with enum or const where possible (diff)
downloadtorus-d5d7c11a43941f51b7fcbc7614fc81fb6cc8d883.tar.gz
torus-d5d7c11a43941f51b7fcbc7614fc81fb6cc8d883.zip
Use anonymous union
Diffstat (limited to '')
-rw-r--r--client.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/client.c b/client.c
index bddf20f..f30bbcc 100644
--- a/client.c
+++ b/client.c
@@ -46,7 +46,7 @@ static void clientMessage(struct ClientMessage msg) {
 static void clientMove(int8_t dx, int8_t dy) {
     struct ClientMessage msg = {
         .type = CLIENT_MOVE,
-        .data.m = { .dx = dx, .dy = dy },
+        .move = { .dx = dx, .dy = dy },
     };
     clientMessage(msg);
 }
@@ -54,7 +54,7 @@ static void clientMove(int8_t dx, int8_t dy) {
 static void clientPut(uint8_t color, char cell) {
     struct ClientMessage msg = {
         .type = CLIENT_PUT,
-        .data.p = { .color = color, .cell = cell },
+        .put = { .color = color, .cell = cell },
     };
     clientMessage(msg);
 }
@@ -62,7 +62,7 @@ static void clientPut(uint8_t color, char cell) {
 static void clientSpawn(uint8_t spawn) {
     struct ClientMessage msg = {
         .type = CLIENT_SPAWN,
-        .data.s.spawn = spawn,
+        .spawn = spawn,
     };
     clientMessage(msg);
 }
@@ -308,25 +308,25 @@ static void readMessage(void) {
         } break;
 
         case SERVER_MOVE: {
-            move(msg.data.m.cellY, msg.data.m.cellX);
+            move(msg.move.cellY, msg.move.cellX);
             refresh();
         } return;
 
         case SERVER_PUT: {
             serverPut(
-                msg.data.p.cellX,
-                msg.data.p.cellY,
-                msg.data.p.color,
-                msg.data.p.cell
+                msg.put.cellX,
+                msg.put.cellY,
+                msg.put.color,
+                msg.put.cell
             );
         } break;
 
         case SERVER_CURSOR: {
             serverCursor(
-                msg.data.c.oldCellX,
-                msg.data.c.oldCellY,
-                msg.data.c.newCellX,
-                msg.data.c.newCellY
+                msg.cursor.oldCellX,
+                msg.cursor.oldCellY,
+                msg.cursor.newCellX,
+                msg.cursor.newCellY
             );
         } break;