]> git.pond.sub.org Git - empserver/commitdiff
Move xysize_range(), xydist_range() to xy.c and xy.h
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 8 Apr 2011 18:38:03 +0000 (20:38 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 14 Apr 2011 18:21:21 +0000 (20:21 +0200)
Moved from snxtsct.c and prototypes.h next to the other struct range
functions.

include/prototypes.h
include/xy.h
src/lib/common/xy.c
src/lib/subs/snxtsct.c

index 1dc4a16019afccca7889ad616ae759712d70dd3e..98140ec3f65b318c6e35dccbcfd3b1ac30dbd9f9 100644 (file)
@@ -648,8 +648,6 @@ extern void snxtitem_cargo(struct nstr_item *, int, int, int);
 /* snxtsct.c */
 extern int snxtsct(struct nstr_sect *, char *);
 extern void snxtsct_area(struct nstr_sect *, struct range *);
 /* snxtsct.c */
 extern int snxtsct(struct nstr_sect *, char *);
 extern void snxtsct_area(struct nstr_sect *, struct range *);
-extern void xydist_range(coord, coord, int, struct range *);
-extern void xysize_range(struct range *);
 extern void snxtsct_all(struct nstr_sect *);
 extern void snxtsct_rewind(struct nstr_sect *);
 extern void snxtsct_dist(struct nstr_sect *, coord, coord, int);
 extern void snxtsct_all(struct nstr_sect *);
 extern void snxtsct_rewind(struct nstr_sect *);
 extern void snxtsct_dist(struct nstr_sect *, coord, coord, int);
index e8fcffb6552ed6d11047f5545afa93db8af316bc..838ccc8f0b3f32d01b17b0f3b5861896005b33a2 100644 (file)
@@ -60,6 +60,8 @@ extern void xyrelrange(struct natstr *np, struct range *src,
                       struct range *dst);
 extern void xyabsrange(struct natstr *np, struct range *src,
                       struct range *dst);
                       struct range *dst);
 extern void xyabsrange(struct natstr *np, struct range *src,
                       struct range *dst);
+extern void xydist_range(coord, coord, int, struct range *);
+extern void xysize_range(struct range *);
 extern coord strtox(char *str, char **end);
 extern coord strtoy(char *str, char **end);
 extern coord xabs(struct natstr *np, coord relx);
 extern coord strtox(char *str, char **end);
 extern coord strtoy(char *str, char **end);
 extern coord xabs(struct natstr *np, coord relx);
index d4d3d27176e02fd54e412c15fe2fb7e4071d1406..fc01b38e9be18c8d0b950b4ad72d91a0d444800c 100644 (file)
@@ -107,6 +107,47 @@ xyabsrange(struct natstr *np, struct range *src, struct range *dst)
     dst->height = src->height;
 }
 
     dst->height = src->height;
 }
 
+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;
+    }
+}
+
 /*
  * Convert initial part of STR to normalized x-coordinate.
  * Return -1 on error.  This works, as normalized coordinates are
 /*
  * Convert initial part of STR to normalized x-coordinate.
  * Return -1 on error.  This works, as normalized coordinates are
index 67504ef73eb84b70f9e66e5a93cc9c6379528efc..9bb76dec10d93c7b477fee1d335c40d10e2828e7 100644 (file)
@@ -150,44 +150,3 @@ snxtsct_dist(struct nstr_sect *np, coord cx, coord cy, int dist)
     np->dx = -1;
     np->dy = 0;
 }
     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;
-    }
-}