Simplify xrel() and yrel()

Value of XNORM() and YNORM() is in [0,WORLD_X) and [0,WORLD_Y),
respectively.
This commit is contained in:
Markus Armbruster 2008-03-24 14:09:51 +01:00
parent 5f76428524
commit ae835ff1db

View file

@ -71,8 +71,6 @@ xrel(struct natstr *np, coord absx)
x = XNORM(absx - np->nat_xorg); x = XNORM(absx - np->nat_xorg);
if (x >= WORLD_X / 2) if (x >= WORLD_X / 2)
x -= WORLD_X; x -= WORLD_X;
else if (x < -WORLD_X / 2)
x += WORLD_X;
return x; return x;
} }
@ -84,8 +82,6 @@ yrel(struct natstr *np, coord absy)
y = YNORM(absy - np->nat_yorg); y = YNORM(absy - np->nat_yorg);
if (y >= WORLD_Y / 2) if (y >= WORLD_Y / 2)
y -= WORLD_Y; y -= WORLD_Y;
else if (y < -WORLD_Y / 2)
y += WORLD_Y;
return y; return y;
} }