about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rwxr-xr-xserver.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/server.c b/server.c
index 8892d2d..cea66c1 100755
--- a/server.c
+++ b/server.c
@@ -129,13 +129,17 @@ static bool clientCast(struct Client *origin, const struct ServerMessage *msg) {
     return success;
 }
 
-static bool clientMove(struct Client *client, int8_t dx, uint8_t dy) {
+static bool clientMove(struct Client *client, int8_t dx, int8_t dy) {
     struct Client old = *client;
 
+    if (dx > CELL_COLS - client->cellX) dx = CELL_COLS - client->cellX;
+    if (dx < -client->cellX - 1)        dx = -client->cellX - 1;
+    if (dy > CELL_ROWS - client->cellY) dy = CELL_ROWS - client->cellY;
+    if (dy < -client->cellY - 1)        dy = -client->cellY - 1;
+
     client->cellX += dx;
     client->cellY += dy;
 
-    // TODO: Handle moves greater than 1 in either direction.
     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; }
07-31Perform enter as two moves rather than a loopJune McEnroe 2017-07-31Track tile access countsJune McEnroe 2017-07-31Adjust move speed in clientJune McEnroe 2017-07-31Handle large movesJune McEnroe 2017-07-30Optimize builds for chrootJune McEnroe 2017-07-30Persist bright across color changesJune McEnroe 2017-07-30Add index.htmlJune McEnroe 2017-07-30Add snapshot.shJune McEnroe 2017-07-30Fix termcap patch for background colorsJune McEnroe 2017-07-30Update helpJune McEnroe 2017-07-30Fix help to track colorJune McEnroe 2017-07-30Support background colorsJune McEnroe 2017-07-30Track color only client-sideJune McEnroe 2017-07-30Add ostensible support for background colorsJune McEnroe 2017-07-30Add tile create and access timestampsJune McEnroe 2017-07-30Assert stable struct Tile field offsetsJune McEnroe 2017-07-30Add chroot.shJune McEnroe 2017-07-30Add ` commandJune McEnroe 2017-07-30Add sshd_configJune McEnroe 2017-07-30Add termcap patchJune McEnroe