summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-26 17:18:57 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-26 17:18:57 +0000
commit1e452a27de8de22d933f5b37c407aa3980948a66 (patch)
treef9403acedd93c5d4b5ea6b0d7eba5e30cb084cad /src/map/map.c
parent8cd1c4cafcf7aa6b49d26a4c81cb6ed6962b3c12 (diff)
downloadhercules-1e452a27de8de22d933f5b37c407aa3980948a66.tar.gz
hercules-1e452a27de8de22d933f5b37c407aa3980948a66.tar.bz2
hercules-1e452a27de8de22d933f5b37c407aa3980948a66.tar.xz
hercules-1e452a27de8de22d933f5b37c407aa3980948a66.zip
Moved distance-related functions to path.c/h
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11981 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/map/map.c b/src/map/map.c
index c4a0847b6..59eef42cc 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -177,52 +177,6 @@ int map_getusers(void)
return map_users;
}
-//Distance functions, taken from http://www.flipcode.com/articles/article_fastdistance.shtml
-int check_distance(int dx, int dy, int distance)
-{
-#ifdef CIRCULAR_AREA
- //In this case, we just do a square comparison. Add 1 tile grace for diagonal range checks.
- return (dx*dx + dy*dy <= distance*distance + (dx&&dy?1:0));
-#else
- if (dx < 0) dx = -dx;
- if (dy < 0) dy = -dy;
- return ((dx<dy?dy:dx) <= distance);
-#endif
-}
-
-unsigned int distance(int dx, int dy)
-{
-#ifdef CIRCULAR_AREA
- unsigned int min, max;
-
- if ( dx < 0 ) dx = -dx;
- if ( dy < 0 ) dy = -dy;
- //There appears to be something wrong with the aproximation below when either dx/dy is 0! [Skotlex]
- if ( dx == 0 ) return dy;
- if ( dy == 0 ) return dx;
-
- if ( dx < dy )
- {
- min = dx;
- max = dy;
- } else {
- min = dy;
- max = dx;
- }
- // coefficients equivalent to ( 123/128 * max ) and ( 51/128 * min )
- return ((( max << 8 ) + ( max << 3 ) - ( max << 4 ) - ( max << 1 ) +
- ( min << 7 ) - ( min << 5 ) + ( min << 3 ) - ( min << 1 )) >> 8 );
-#else
- if (dx < 0) dx = -dx;
- if (dy < 0) dy = -dy;
- return (dx<dy?dy:dx);
-#endif
-}
-
-//
-// block削除の安全性確保?理
-//
-
/*==========================================
* blockをfreeするときfreeの?わりに呼ぶ
* ロックされているときはバッファにためる