diff options
author | June McEnroe <june@causal.agency> | 2018-04-09 01:25:43 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-04-09 01:25:43 -0400 |
commit | 6dadef0381d8b7a63f40b185b3592f27b55453cd (patch) | |
tree | ca6784a44b5154af2f707b5a213b0b5b796cd29d /client.c | |
parent | Replace #define with enum or const where possible (diff) | |
download | torus-6dadef0381d8b7a63f40b185b3592f27b55453cd.tar.gz torus-6dadef0381d8b7a63f40b185b3592f27b55453cd.zip |
Use anonymous union
Diffstat (limited to '')
-rw-r--r-- | client.c | 24 |
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; |