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 <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2020-07-26 07:30:58 +02:00
parent d4dcfeec54
commit 4f0af0bae0

View file

@ -99,6 +99,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
@ -518,12 +519,15 @@ init(void)
DRIFT THE CAPITALS UNTIL THEY ARE AS FAR AWAY FROM EACH OTHER AS POSSIBLE 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 static int
iso(int j, int newx, int newy) 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) { for (i = 0; i < nc; ++i) {
if (i == j) if (i == j)