diff options
author | June McEnroe <june@causal.agency> | 2018-03-05 12:58:58 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-03-05 12:58:58 -0500 |
commit | 2dcf768ed895f65771da689236db0a25bf827fe9 (patch) | |
tree | 800dce64526c0656a92458afe74d3780414f4770 /server.c | |
parent | Pass message structs by value (diff) | |
download | torus-2dcf768ed895f65771da689236db0a25bf827fe9.tar.gz torus-2dcf768ed895f65771da689236db0a25bf827fe9.zip |
Miscellaneous code cleanup
Diffstat (limited to '')
-rw-r--r-- | server.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/server.c b/server.c index cc1bdc3..f9b16a5 100644 --- a/server.c +++ b/server.c @@ -238,10 +238,22 @@ static bool clientMove(struct Client *client, int8_t dx, int8_t dy) { client->cellX += dx; client->cellY += dy; - if (client->cellX == CELL_COLS) { client->tileX++; client->cellX = 0; } - if (client->cellX == UINT8_MAX) { client->tileX--; client->cellX = CELL_COLS - 1; } - if (client->cellY == CELL_ROWS) { client->tileY++; client->cellY = 0; } - if (client->cellY == UINT8_MAX) { client->tileY--; client->cellY = CELL_ROWS - 1; } + if (client->cellX == CELL_COLS) { + client->tileX++; + client->cellX = 0; + } + if (client->cellX == UINT8_MAX) { + client->tileX--; + client->cellX = CELL_COLS - 1; + } + if (client->cellY == CELL_ROWS) { + client->tileY++; + client->cellY = 0; + } + if (client->cellY == UINT8_MAX) { + client->tileY--; + client->cellY = CELL_ROWS - 1; + } if (client->tileX == TILE_COLS) client->tileX = 0; if (client->tileX == UINT32_MAX) client->tileX = TILE_COLS - 1; |