From 77cac05d9b256039f7b2b5b00f901ad76fddfe86 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> Date: Fri, 11 Feb 2005 14:56:54 +0000 Subject: 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 --- Changelog.txt | 3 +++ src/map/map.c | 31 +++++++++++++++++++++++++++++++ src/map/skill.c | 1 + 3 files changed, 35 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index ea0f583bb..181fd2f2c 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,9 @@ Date Added 02/11 + * not realy fixing the "unknown skill" error + but returning skill_castend_damage_id when called with skillid < 0 + still need to search a reason why it is called with -1 [Shinomori] * EXPERIMENTAL: Reduced memory used for the skill_tree DB by 30+mb [celest] * Added script commands isday and isnight - checks whether its night or daytime. Example: if(isnight()) ... [celest] 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); -- cgit v1.2.3-70-g09d2