(diridx): New. Use instead of chkdir() where direction characters
must be valid. Oopses on bad direction characters. (pathtoxy, ac_encounter): Bad direction characters used to lead to bad array subscript and potential disaster. (pathrange, path): Stop on DIR_STOP as well as on bad direction characters. This is just for consistency with other code; DIR_STOP should occur only last in a path here. (sail_nav_fleet, nav_ship): No change except for the oops.
This commit is contained in:
parent
a88f12017e
commit
dfa56cb0ef
6 changed files with 31 additions and 18 deletions
|
@ -101,7 +101,10 @@ path(void)
|
|||
natp = getnatp(player->cnum);
|
||||
xyrelrange(natp, &absrange, &relrange);
|
||||
blankfill((s_char *)mapbuf, &ns.range, 3);
|
||||
while (*pp && (i = chkdir(*pp, DIR_STOP, DIR_LAST)) >= 0) {
|
||||
for (; *pp; ++pp) {
|
||||
i = diridx(*pp);
|
||||
if (i == DIR_STOP)
|
||||
break;
|
||||
memcpy(&map[deltay(cy, ns.range.ly)][deltax(cx, ns.range.lx) * 2],
|
||||
routech[i][0],
|
||||
3);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue