path() failed to normalize coordinate argument for deltx() and
delty(). This could subscript map[] and mapbuf[] out of bounds.
Broken in commit 3ca88271.
The correct method to compute indexes into a map buffer for a struct
range is deltx(), delty().
path() used deltax(), deltay() instead, which yield correct results
only for indexes up to half the world size. Pathes spanning larger
areas were screwed up.
sona(), radmap2(), satmap() also used deltax(), deltay(), but only
with arguments where those yield correct results.
draw_map() used xnorm(), ynorm() instead, which is correct, but less
clear and less efficient.
other. Ensure headers in include/ can be included in any order
(except for econfig-spec.h, which is special). New header types.h to
help avoid inclusion cycles. Sort include directives. Remove some
superflous includes.
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.
thread entrypoints:
(lwpSelect, shutdown_sequence): Parameters didn't match thread entry
point prototype.
(lwpEntryPoint): Arguments didn't match thread entry point prototype.
Change linkage of functions without prototype declaration to static
where possible.
Remove some superflous declarations, replace others by suitable
includes.
effect. Replace calls by struct assignment where possible. Replace
clear buffer, copy string to buffer by strncpy(). Use assignment to
clear when that's clearer. Replace overlapping copy through bounce
buffer by memmove(). Replace rest by standard memset() and memcpy().
Also use sizeof() instead of literal array sizes for robustness, and
instead of symbolic array sizes for clarity.