summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2017-09-03 15:34:21 -0400
committerJune McEnroe <programble@gmail.com>2017-09-03 15:34:21 -0400
commit811419e17b70f93cb85fc26c9b7227f53349a7a7 (patch)
tree421db63f1077768e0a168263b0d4767b5a3972ed
parentRelicense AGPL (diff)
downloadtorus-811419e17b70f93cb85fc26c9b7227f53349a7a7.tar.gz
torus-811419e17b70f93cb85fc26c9b7227f53349a7a7.zip
Assert client coords are valid after movement
-rw-r--r--server.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/server.c b/server.c
index a7587d8..009243a 100644
--- a/server.c
+++ b/server.c
@@ -249,6 +249,11 @@ static bool clientMove(struct Client *client, int8_t dx, int8_t dy) {
     if (client->tileY == TILE_ROWS)  client->tileY = 0;
     if (client->tileY == UINT32_MAX) client->tileY = TILE_ROWS - 1;
 
+    assert(client->cellX < CELL_COLS);
+    assert(client->cellY < CELL_ROWS);
+    assert(client->tileX < TILE_COLS);
+    assert(client->tileY < TILE_ROWS);
+
     return clientUpdate(client, &old);
 }