From 019ab0e7cf747749d08903eb88a1a4d62c57dae8 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 18 Jun 2006 09:13:35 +0000 Subject: [PATCH] (bestownedpath): Back out rev. 1.22's path termination with 'h' for now. Consistency with BestLandPath() is nice, but it makes navigate behave differently, and that wasn't intended. --- src/lib/common/bestpath.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/common/bestpath.c b/src/lib/common/bestpath.c index fe250192..5df5601c 100644 --- a/src/lib/common/bestpath.c +++ b/src/lib/common/bestpath.c @@ -79,7 +79,9 @@ static unsigned short **mapindex; * the usual rules. * Other sectors are assumed to be passable when BIGMAP shows '.' or * nothing. - * Return path or a null pointer. + * Return a path if found, else a null pointer. + * Wart: the path isn't terminated with 'h', except when if X,Y equals + * EX,EY. */ char * bestownedpath(char *bpath, char *bigmap, @@ -130,7 +132,7 @@ bestownedpath(char *bpath, char *bigmap, maxy = y + 1; do { - if (++routelen == MAXROUTE - 1) + if (++routelen == MAXROUTE) return NULL; markedsectors = 0; for (scanx = minx; scanx <= maxx; scanx++) { @@ -155,8 +157,7 @@ bestownedpath(char *bpath, char *bigmap, } } if (tx == ex && ty == ey) { - bpath[routelen] = 'h'; - bpath[routelen + 1] = 0; + bpath[routelen] = 0; while (routelen--) { i = (mapindex[tx][ty] >> 13) - 1 + DIR_FIRST;