subs: Clean up direction code range checks

Compare with DIR_LAST instead of DIR_VIEW, to avoid assuming DIR_VIEW
is the first non-direction code.

While there, oops on unexpected code.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-01-04 17:52:36 +01:00
parent 2294785412
commit bbacc28606
2 changed files with 4 additions and 2 deletions

View file

@ -1021,7 +1021,8 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor)
if (CANT_HAPPEN(QEMPTY(list)))
return 1;
if (dir <= DIR_STOP || dir >= DIR_VIEW) {
if (dir <= DIR_STOP || dir > DIR_LAST) {
CANT_HAPPEN(dir != DIR_STOP);
lnd_mar_put(list, actor);
return 1;
}

View file

@ -796,7 +796,8 @@ shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor)
if (CANT_HAPPEN(QEMPTY(list)))
return 1;
if (dir <= DIR_STOP || dir >= DIR_VIEW) {
if (dir <= DIR_STOP || dir > DIR_LAST) {
CANT_HAPPEN(dir != DIR_STOP);
shp_nav_put(list, actor);
return 1;
}