diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/map.c | 31 | ||||
-rw-r--r-- | src/map/skill.c | 1 |
2 files changed, 32 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++) { diff --git a/src/map/skill.c b/src/map/skill.c index 8caaca02c..7f5843d55 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2212,6 +2212,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s struct status_change *sc_data = status_get_sc_data(src); int i; + if(skillid < 0) return 0; if(skillid > 0 && skilllv <= 0) return 0; nullpo_retr(1, src); |