浏览代码

- Added a check un unit_run when unit_walktoxy fails. Should fix running getting you stuck sometimes when running on diagonals near obstacles.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8900 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 18 年之前
父节点
当前提交
a23e7c9802
共有 3 个文件被更改,包括 20 次插入2 次删除
  1. 4 0
      Changelog-Trunk.txt
  2. 1 1
      src/map/status.c
  3. 15 1
      src/map/unit.c

+ 4 - 0
Changelog-Trunk.txt

@@ -3,6 +3,10 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2006/09/29
+	* Added a check un unit_run when unit_walktoxy fails. Should fix running
+	  getting you stuck sometimes when running on diagonals near obstacles.
+	  [Skotlex]
 2006/09/28
 	* Merged the necessary changes to make the script engine support negative
 	  constants (db/const.txt). Thanks to Rayce (from jA) for the code. [Skotlex]

+ 1 - 1
src/map/status.c

@@ -2389,7 +2389,7 @@ int status_calc_homunculus(struct homun_data *hd, int first)
 			*hd->homunculusDB->baseASPD/1000;
 	
 	status->amotion = cap_value(skill,battle_config.max_aspd,2000);
-	status->adelay = 2*status->amotion;
+	status->adelay = status->amotion; //It seems adelay = amotion for Homunculus.
 
 	status_calc_misc(&hd->bl, status, hom->level);
 	status_calc_bl(&hd->bl, SCB_ALL); //Status related changes.

+ 15 - 1
src/map/unit.c

@@ -393,7 +393,21 @@ int unit_run(struct block_list *bl)
 		clif_status_change(bl, SI_BUMP, 0);
 		return 0;
 	}
-	unit_walktoxy(bl, to_x, to_y, 1);
+	if (unit_walktoxy(bl, to_x, to_y, 1))
+		return 1;
+	//There must be an obstacle nearby. Attempt walking one cell at a time.
+	do {
+		to_x -= dir_x;
+		to_y -= dir_y;
+	} while (--i > 0 && !unit_walktoxy(bl, to_x, to_y, 1));
+	if (i==0) {
+		clif_status_change(bl, SI_BUMP, 1);
+		status_change_end(bl,SC_RUN,-1);
+		skill_blown(bl,bl,skill_get_blewcount(TK_RUN,sc->data[SC_RUN].val1)|0x10000);
+		clif_fixpos(bl);
+		clif_status_change(bl, SI_BUMP, 0);
+		return 0;
+	}
 	return 1;
 }