(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.
This commit is contained in:
Markus Armbruster 2006-06-18 09:13:35 +00:00
parent 3eef93d97b
commit 019ab0e7cf

View file

@ -79,7 +79,9 @@ static unsigned short **mapindex;
* the usual rules. * the usual rules.
* Other sectors are assumed to be passable when BIGMAP shows '.' or * Other sectors are assumed to be passable when BIGMAP shows '.' or
* nothing. * 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 * char *
bestownedpath(char *bpath, char *bigmap, bestownedpath(char *bpath, char *bigmap,
@ -130,7 +132,7 @@ bestownedpath(char *bpath, char *bigmap,
maxy = y + 1; maxy = y + 1;
do { do {
if (++routelen == MAXROUTE - 1) if (++routelen == MAXROUTE)
return NULL; return NULL;
markedsectors = 0; markedsectors = 0;
for (scanx = minx; scanx <= maxx; scanx++) { for (scanx = minx; scanx <= maxx; scanx++) {
@ -155,8 +157,7 @@ bestownedpath(char *bpath, char *bigmap,
} }
} }
if (tx == ex && ty == ey) { if (tx == ex && ty == ey) {
bpath[routelen] = 'h'; bpath[routelen] = 0;
bpath[routelen + 1] = 0;
while (routelen--) { while (routelen--) {
i = (mapindex[tx][ty] >> 13) i = (mapindex[tx][ty] >> 13)
- 1 + DIR_FIRST; - 1 + DIR_FIRST;