about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-12-01 15:40:17 -0500
committerJune McEnroe <june@causal.agency>2021-12-01 15:40:17 -0500
commit9e505a78a500f50721b59c0263cee311145ac400 (patch)
tree5b0b9f45b9feea38c205dbf083b0fe0fc568f84f
parentRemove capsicum support (diff)
downloadtorus-9e505a78a500f50721b59c0263cee311145ac400.tar.gz
torus-9e505a78a500f50721b59c0263cee311145ac400.zip
Decay
-rw-r--r--server.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/server.c b/server.c
index fc35640..3c26f09 100644
--- a/server.c
+++ b/server.c
@@ -67,6 +67,16 @@ static struct Tile *tileAccess(uint32_t tileX, uint32_t tileY) {
 	struct Tile *tile = tileGet(tileX, tileY);
 	tile->accessTime = time(NULL);
 	tile->accessCount++;
+#ifndef NO_DECAY
+	uint8_t y = arc4random_uniform(CellRows);
+	uint8_t x = arc4random_uniform(CellCols);
+	uint8_t b = 1 << arc4random_uniform(8);
+	if (arc4random_uniform(2)) {
+		tile->cells[y][x] &= ~b;
+	} else {
+		tile->colors[y][x] &= ~b;
+	}
+#endif
 	return tile;
 }