]> git.pond.sub.org Git - empserver/commitdiff
Fix deltx() for x < r->lx && r->lx < r->hx; likewise delty()
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 16 Aug 2008 18:57:13 +0000 (14:57 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 19 Aug 2008 12:54:04 +0000 (08:54 -0400)
Bug couldn't bite, because callers pass only coordinates within the
interval.

src/lib/subs/radmap.c

index 0ab3c12b3fc678f2a64e863e7bd4a47560ce2d08..0485782362c463439f66b66c2c74d003ca8550f4 100644 (file)
@@ -189,26 +189,28 @@ radmap2(int owner,
     pr("\n");
 }
 
+/*
+ * Return distance from left edge of R to X.
+ * Value is between 0 (inclusive) and WORLD_X (exclusive).
+ * X must be normalized.
+ */
 int
 deltx(struct range *r, coord x)
 {
-    if (r->lx < r->hx)
-       return x - r->lx;
-
     if (x >= r->lx)
        return x - r->lx;
-
     return x + WORLD_X - r->lx;
 }
 
+/*
+ * Return distance from top edge of R to Y.
+ * Value is between 0 (inclusive) and WORLD_Y (exclusive).
+ * Y must be normalized.
+ */
 int
 delty(struct range *r, coord y)
 {
-    if (r->ly < r->hy)
-       return y - r->ly;
-
     if (y >= r->ly)
        return y - r->ly;
-
     return y + WORLD_Y - r->ly;
 }