(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
|
@ -129,7 +129,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
|||
|
||||
pln_removedupes(bomb_list, esc_list);
|
||||
while ((dir = mypath[myp++]) && !QEMPTY(bomb_list)) {
|
||||
if ((val = chkdir(dir, DIR_STOP, DIR_LAST)) == 0)
|
||||
if ((val = diridx(dir)) == DIR_STOP)
|
||||
break;
|
||||
/* XXX using xnorm is probably bad */
|
||||
x = xnorm(x + diroff[val][0]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue