From 3ed39a4b2880a62fc6fc950d18ab8e9d05f0e0b0 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Wed, 1 Dec 2021 15:40:17 -0500 Subject: Decay --- server.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; } -- cgit 1.4.1