瀏覽代碼

a try on the "unknown skill" error [Shinomori]

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1075 54d463be-8e91-2dee-dedb-b68131a5f0ec
(no author) 20 年之前
父節點
當前提交
86cad0c7fe
共有 3 個文件被更改,包括 35 次插入0 次删除
  1. 3 0
      Changelog.txt
  2. 31 0
      src/map/map.c
  3. 1 0
      src/map/skill.c

+ 3 - 0
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]

+ 31 - 0
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++) {

+ 1 - 0
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);