summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
author(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-11 14:56:54 +0000
committer(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-11 14:56:54 +0000
commit77cac05d9b256039f7b2b5b00f901ad76fddfe86 (patch)
treed1b03b2f49504ed2216fae91dfed2e2148ff5bb4 /src/map/map.c
parenta1b35482fdba21356c1d7e90e55ea213a8af0f58 (diff)
downloadhercules-77cac05d9b256039f7b2b5b00f901ad76fddfe86.tar.gz
hercules-77cac05d9b256039f7b2b5b00f901ad76fddfe86.tar.bz2
hercules-77cac05d9b256039f7b2b5b00f901ad76fddfe86.tar.xz
hercules-77cac05d9b256039f7b2b5b00f901ad76fddfe86.zip
a try on the "unknown skill" error [Shinomori]
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1075 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/map/map.c b/src/map/map.c
index cdac73838..6cab9afba 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -683,6 +683,37 @@ void map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int
in = y0 - s * x0;
}
//printf ("%lf %d\n", s, in);
+// I'm not finished thinking on it
+// but first it might better use a parameter equation
+// x=(x1-x0)*t+x0; y=(y1-y0)*t+y0; t=[0,1]
+// would not need special case aproximating for infinity/zero slope
+// so maybe this way:
+/*
+ double deltax = 0.0;
+ double deltay = 0.0;
+ int t;
+ // find maximum runindex
+ int tmax = abs(y1-y0);
+ if(tmax < abs(x1-x0))
+ tmax = abs(x1-x0);
+
+ // pre-calculate delta values for x and y destination
+ // should speed up cause you don't need to divide in the loop
+ if(tmax>0)
+ {
+ deltax = ((double)(x1-x0)) / ((double)tmax);
+ deltay = ((double)(y1-y0)) / ((double)tmax);
+ }
+ // go along the index
+ for(t=0; t<=tmax; t++)
+ {
+ int x = (int)floor(deltax * (double)t +0.5)+x0;
+ int y = (int)floor(deltay * (double)t +0.5)+y0;
+ // the xy pairs of points in line between x0y0 and x1y1
+ // including start and end point
+ printf("%i\t%i\n",x,y);
+ }
+ */
if (type == 0 || type != BL_MOB)
for (by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++) {