about 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
commit6dadef0381d8b7a63f40b185b3592f27b55453cd (patch)
treeca6784a44b5154af2f707b5a213b0b5b796cd29d /client.c
parentReplace #define with enum or const where possible (diff)
downloadtorus-6dadef0381d8b7a63f40b185b3592f27b55453cd.tar.gz
torus-6dadef0381d8b7a63f40b185b3592f27b55453cd.zip
Use anonymous union
Diffstat (limited to 'client.c')
-rw-r--r--client.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/client.c b/client.c
index ef51ae0..55a12d5 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;
 
2021-05-25import: Add missing scripts/wrap-compiler-for-flag-checkJune McEnroe 2021-05-08Import LibreSSL 3.3.3June McEnroe 2021-04-18build: Remove added x509_verify.3 links 3.3.2June McEnroe 2021-04-18tls: Use EC_KEY_set_ex_dataJune McEnroe 2021-04-18Import LibreSSL 3.3.2June McEnroe 2021-03-05Bump version to 3.3.1p1 3.3.1p1June McEnroe 2021-03-05build: Add OpenSSL includes to libcompatJune McEnroe Some compat sources (getentropy_linux.c for example) require OpenSSL. Reported by Robert Scheck. 2020-12-15Import LibreSSL 3.3.1June McEnroe 2020-11-24Import LibreSSL 3.3.0June McEnroe 2020-10-22Import LibreSSL 3.2.2June McEnroe 2020-09-29Import LibreSSL 3.2.1June McEnroe 2020-09-29import: Add m4/ax_add_fortify_source.m4June McEnroe 2020-08-05build: Add README.7 to EXTRA_DIST 3.2.0June McEnroe 2020-08-03doc: Indicate that only OpenSSL 1.1.1b and newer workJune McEnroe