Fix computation of map buffer indexes

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.
This commit is contained in:
Markus Armbruster 2008-08-16 21:56:28 -04:00
parent 42a8b315e5
commit 3ca882714d
5 changed files with 8 additions and 20 deletions

View file

@ -175,15 +175,9 @@ radmap2(int owner,
* make the center of the display 0
* so ve et al can find it.
*/
rad[deltay(cy, ns.range.ly)][deltax(cx, ns.range.lx)] = '0';
/* won't work for radar maps > WORLD_Y/2 */
#ifdef HAY
/* This is not correct for small, hitech worlds. */
n = deltay(ns.range.hy, ns.range.ly);
#else
/* This is already available, so why not use it. */
rad[delty(&ns.range, cy)][deltx(&ns.range, cx)] = '0';
n = ns.range.height;
#endif
for (row = 0; row < n; row++)
pr("%s\n", rad[row]);
pr("\n");