]> git.pond.sub.org Git - empserver/blobdiff - src/lib/common/mapdist.c
Update copyright notice
[empserver] / src / lib / common / mapdist.c
index cac702f454439f1a64544c68fe57276520b75670..7ebc97cbe9031f057746fe583264228f48c51a15 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
+ *  Copyright (C) 1986-2012, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *                Ken Stevens, Steve McClure, Markus Armbruster
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  Empire is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
+ *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  *  ---
  *
  *  ---
  *
  *  mapdist.c: Return the distance between two sectors
- * 
+ *
  *  Known contributors to this file:
- *     
- */
-
-/*
- * mapdist returns (integer) distance between two sectors.
+ *
  */
 
 #include <config.h>
 #include "optlist.h"
 #include "prototypes.h"
 
-int
-diffx(int x1, int x2)
-{
-    int dx;
-
-    dx = x1 - x2;
-    dx = dx % WORLD_X;
-    if (dx > WORLD_X / 2)
-       dx = dx - WORLD_X;
-    if (dx < -WORLD_X / 2)
-       dx = dx + WORLD_X;
-    return dx;
-}
-
-int
-diffy(int y1, int y2)
-{
-    int dy;
-
-    dy = y1 - y2;
-    dy = dy % WORLD_Y;
-    if (dy > WORLD_Y / 2)
-       dy = dy - WORLD_Y;
-    if (dy < -WORLD_Y / 2)
-       dy = dy + WORLD_Y;
-    return dy;
-}
-
-int
+static int
 deltax(int x1, int x2)
 {
     int dx;
@@ -81,7 +48,7 @@ deltax(int x1, int x2)
     return dx;
 }
 
-int
+static int
 deltay(int y1, int y2)
 {
     int dy;
@@ -98,10 +65,6 @@ mapdist(int x1, int y1, int x2, int y2)
 {
     int dx, dy;
 
-    x1 = x1 % WORLD_X;
-    y1 = y1 % WORLD_Y;
-    x2 = x2 % WORLD_X;
-    y2 = y2 % WORLD_Y;
     dx = deltax(x1, x2);
     dy = deltay(y1, y2);
     if (dx > dy)