summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
authorrud0lp20 <rud0lp20@54d463be-8e91-2dee-dedb-b68131a5f0ec>2013-01-10 18:17:32 +0000
committerrud0lp20 <rud0lp20@54d463be-8e91-2dee-dedb-b68131a5f0ec>2013-01-10 18:17:32 +0000
commitde0374e0afa0fe11e5609d619a222754a5e879c5 (patch)
tree12791944920536ae2d18e7735bfdac6f137b83e5 /src/map/unit.c
parentbac08d580258b69b365db32ab1705df232851c5b (diff)
downloadhercules-de0374e0afa0fe11e5609d619a222754a5e879c5.tar.gz
hercules-de0374e0afa0fe11e5609d619a222754a5e879c5.tar.bz2
hercules-de0374e0afa0fe11e5609d619a222754a5e879c5.tar.xz
hercules-de0374e0afa0fe11e5609d619a222754a5e879c5.zip
Implemented official walk path dealing with obstacle.(bugreport:6159)
-see 'src/config/core.h' for settings[OFFICIAL_WALKPATH]. Fixed bugreport:7057 where HP_ASSUMPTIO should only double eDEF & eMDEF. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17091 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index e0dc69d15..0104e9a42 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -315,16 +315,21 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
{
struct unit_data* ud = NULL;
struct status_change* sc = NULL;
-
+#ifdef OFFICIAL_WALKPATH
+ struct walkpath_data wpd;
+#endif
nullpo_ret(bl);
ud = unit_bl2ud(bl);
if( ud == NULL) return 0;
-// disabled until we find the correct algorithm. [malufett]
-//#ifdef OFFICIAL_WALKPATH
-// if( !path_search_long(NULL, bl->m, bl->x, bl->y, x, y, CELL_CHKWALL) ) return 0;
-//#endif
+
+#ifdef OFFICIAL_WALKPATH
+ if( path_search(&wpd, bl->m, bl->x, bl->y, x, y, flag&1, CELL_CHKNOPASS) // Check if there is an obstacle between
+ && wpd.path_len > 14 ) // Official number of walkable cells is 14 if and only if there is an obstacle between. [malufett]
+ return 0;
+#endif
+
if (flag&4 && DIFF_TICK(ud->canmove_tick, gettick()) > 0 &&
DIFF_TICK(ud->canmove_tick, gettick()) < 2000)
{ // Delay walking command. [Skotlex]