(bestownedpath): Return NULL on long path instead of "?". Terminate
returned path with 'h'. This makes BestShipPath() and BestAirPath() more similar to BestLandPath(). Simplify callers.
This commit is contained in:
parent
9c27a771b3
commit
abb9ae2338
3 changed files with 6 additions and 7 deletions
|
@ -176,8 +176,8 @@ bestownedpath(s_char *bpath,
|
|||
maxy = y + 1;
|
||||
|
||||
do {
|
||||
if (++routelen == MAXROUTE)
|
||||
return "?";
|
||||
if (++routelen == MAXROUTE - 1)
|
||||
return NULL;
|
||||
markedsectors = 0;
|
||||
for (scanx = minx; scanx <= maxx; scanx++) {
|
||||
x = XNORM(scanx);
|
||||
|
@ -200,7 +200,8 @@ bestownedpath(s_char *bpath,
|
|||
}
|
||||
}
|
||||
if (tx == ex && ty == ey) {
|
||||
bpath[routelen] = 0;
|
||||
bpath[routelen] = 'h';
|
||||
bpath[routelen + 1] = 0;
|
||||
while (routelen--) {
|
||||
i = ((mapindex[tx][ty]) >> 13) - 1;
|
||||
bpath[routelen] = dirchar[i];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue