about summary refs log tree commit diff homepage
path: root/client.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-07-23 01:17:10 -0400
committerJune McEnroe <june@causal.agency>2018-07-23 01:17:10 -0400
commitb8c4a9e4bc6cebd637900a4807c108ef48c78954 (patch)
tree58709909251180010d7814b509578886165b70d8 /client.c
parentAdd libm.so to chroot.tar (diff)
downloadtorus-b8c4a9e4bc6cebd637900a4807c108ef48c78954.tar.gz
torus-b8c4a9e4bc6cebd637900a4807c108ef48c78954.zip
Fix NaNs in serverMap
When there are very few touched tiles, even if they are recent, they
will appear blue, because timeMin is also recent. I should figure out
how to fix that.
Diffstat (limited to '')
-rw-r--r--client.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/client.c b/client.c
index 7ffbd9e..d46649b 100644
--- a/client.c
+++ b/client.c
@@ -360,10 +360,10 @@ static void serverMap(void) {
 		for (int x = 0; x < MAP_COLS; ++x) {
 			struct MapTile tile = map.tiles[y][x];
 
-			double count = (tile.modifyCount)
+			double count = (tile.modifyCount && countMax > 1)
 				? log(tile.modifyCount) / log(countMax)
 				: 0.0;
-			double time = (tile.modifyTime)
+			double time = (tile.modifyTime && timeNow - timeMin)
 				? (double)(tile.modifyTime - timeMin) / (double)(timeNow - timeMin)
 				: 0.0;
 			count *= ARRAY_LEN(MAP_CELLS) - 2;