Move xysize_range(), xydist_range() to xy.c and xy.h
Moved from snxtsct.c and prototypes.h next to the other struct range functions.
This commit is contained in:
parent
e7d7cfdc10
commit
40b6032a5d
4 changed files with 43 additions and 43 deletions
|
@ -150,44 +150,3 @@ snxtsct_dist(struct nstr_sect *np, coord cx, coord cy, int dist)
|
|||
np->dx = -1;
|
||||
np->dy = 0;
|
||||
}
|
||||
|
||||
void
|
||||
xysize_range(struct range *rp)
|
||||
{
|
||||
if (rp->lx > rp->hx)
|
||||
rp->width = WORLD_X + rp->hx + 1 - rp->lx;
|
||||
else
|
||||
rp->width = rp->hx + 1 - rp->lx;
|
||||
if (CANT_HAPPEN(rp->width > WORLD_X))
|
||||
rp->width = WORLD_X;
|
||||
if (rp->ly > rp->hy)
|
||||
rp->height = WORLD_Y + rp->hy + 1 - rp->ly;
|
||||
else
|
||||
rp->height = rp->hy + 1 - rp->ly;
|
||||
if (CANT_HAPPEN(rp->height > WORLD_Y))
|
||||
rp->height = WORLD_Y;
|
||||
}
|
||||
|
||||
void
|
||||
xydist_range(coord x, coord y, int dist, struct range *rp)
|
||||
{
|
||||
if (4 * dist + 1 < WORLD_X) {
|
||||
rp->lx = xnorm(x - 2 * dist);
|
||||
rp->hx = xnorm(x + 2 * dist);
|
||||
rp->width = 4 * dist + 1;
|
||||
} else {
|
||||
rp->lx = xnorm(x - WORLD_X / 2);
|
||||
rp->hx = xnorm(rp->lx + WORLD_X - 1);
|
||||
rp->width = WORLD_X;
|
||||
}
|
||||
|
||||
if (2 * dist + 1 < WORLD_Y) {
|
||||
rp->ly = ynorm(y - dist);
|
||||
rp->hy = ynorm(y + dist);
|
||||
rp->height = 2 * dist + 1;
|
||||
} else {
|
||||
rp->ly = ynorm(y - WORLD_Y / 2);
|
||||
rp->hy = ynorm(rp->ly + WORLD_Y - 1);
|
||||
rp->height = WORLD_Y;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue