about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorC. McEnroe <june@causal.agency>2021-12-01 15:40:17 -0500
committerC. McEnroe <june@causal.agency>2021-12-01 15:40:17 -0500
commit3ed39a4b2880a62fc6fc950d18ab8e9d05f0e0b0 (patch)
tree15a1fece6323b89c75b50d3548479401eefd69e2
parentRemove capsicum support (diff)
downloadtorus-3ed39a4b2880a62fc6fc950d18ab8e9d05f0e0b0.tar.gz
torus-3ed39a4b2880a62fc6fc950d18ab8e9d05f0e0b0.zip
Decay
-rw-r--r--server.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/server.c b/server.c
index b06ff3f..450810e 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;
 }