From 4f0af0bae0a98e452127552b5c15499ac25e5be6 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 26 Jul 2020 07:30:58 +0200 Subject: [PATCH] fairland: Use INT_MAX as initial minimal distance in iso() Simpler and more obviously correct than WORLD_X + WORLD_Y. Signed-off-by: Markus Armbruster --- src/util/fairland.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/util/fairland.c b/src/util/fairland.c index a4c0c06a7..7f58e0254 100644 --- a/src/util/fairland.c +++ b/src/util/fairland.c @@ -99,6 +99,7 @@ #include #include +#include #include #include #include @@ -518,12 +519,15 @@ init(void) DRIFT THE CAPITALS UNTIL THEY ARE AS FAR AWAY FROM EACH OTHER AS POSSIBLE ****************************************************************************/ -/* How isolated is capital j? -*/ +/* + * How isolated is capital @j at @newx,@newy? + * Return the distance to the closest other capital. + */ static int iso(int j, int newx, int newy) { - int i, md, d = WORLD_X + WORLD_Y; + int d = INT_MAX; + int i, md; for (i = 0; i < nc; ++i) { if (i == j) -- 2.43.0