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:
parent
42a8b315e5
commit
3ca882714d
5 changed files with 8 additions and 20 deletions
|
@ -100,7 +100,7 @@ path(void)
|
|||
i = diridx(*pp);
|
||||
if (i == DIR_STOP)
|
||||
break;
|
||||
memcpy(&map[deltay(cy, ns.range.ly)][deltax(cx, ns.range.lx) * 2],
|
||||
memcpy(&map[delty(&ns.range, cy)][deltx(&ns.range, cx) * 2],
|
||||
routech[i][0],
|
||||
3);
|
||||
cx += diroff[i][0];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue