Fix XNORM() and YNORM()
Broken in commit5f764285
(v4.3.12) for negative multiples of WORLD_X and WORLD_Y, respectively. This could theoretically lead to buffer overruns and other unpleasantness. None have been reproduced, though. (cherry picked from commit7680acc39f
)
This commit is contained in:
parent
e2eccc5740
commit
7dc0f48868
1 changed files with 2 additions and 2 deletions
|
@ -43,9 +43,9 @@
|
||||||
#define XYOFFSET(x, y) (((y) * WORLD_X + (x)) / 2)
|
#define XYOFFSET(x, y) (((y) * WORLD_X + (x)) / 2)
|
||||||
|
|
||||||
#define XNORM(x) \
|
#define XNORM(x) \
|
||||||
(((x) < 0) ? (WORLD_X - (-(x) % WORLD_X)) : ((x) % WORLD_X))
|
(((x) < 0) ? (WORLD_X - 1 - ((-(x) - 1) % WORLD_X)) : ((x) % WORLD_X))
|
||||||
#define YNORM(y) \
|
#define YNORM(y) \
|
||||||
(((y) < 0) ? (WORLD_Y - (-(y) % WORLD_Y)) : ((y) % WORLD_Y))
|
(((y) < 0) ? (WORLD_Y - 1 - ((-(y) - 1) % WORLD_Y)) : ((y) % WORLD_Y))
|
||||||
|
|
||||||
struct range {
|
struct range {
|
||||||
coord lx; /* low-range x,y */
|
coord lx; /* low-range x,y */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue