diff options
author | wushin <pasekei@gmail.com> | 2015-09-20 13:26:14 -0500 |
---|---|---|
committer | wushin <pasekei@gmail.com> | 2015-09-20 13:26:14 -0500 |
commit | e03f2eab4f78b7c505b985826ee4412cbc977a03 (patch) | |
tree | 14fdcb44bc9cfecf5b3e80b907cdddb2a37b785e | |
parent | ce49c4725855137624d854ece6513bd52f5d6122 (diff) | |
download | tmwa-e03f2eab4f78b7c505b985826ee4412cbc977a03.tar.gz tmwa-e03f2eab4f78b7c505b985826ee4412cbc977a03.tar.bz2 tmwa-e03f2eab4f78b7c505b985826ee4412cbc977a03.tar.xz tmwa-e03f2eab4f78b7c505b985826ee4412cbc977a03.zip |
More abs errors on direction
-rw-r--r-- | src/map/mob.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/map/mob.cpp b/src/map/mob.cpp index 539b547..d6bd80b 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -1277,15 +1277,18 @@ int mob_stop_walking(dumb_ptr<mob_data> md, int type) static int mob_can_reach(dumb_ptr<mob_data> md, dumb_ptr<block_list> bl, int range) { - int dx, dy; + int dx, dy, rangex, rangey, arange; struct walkpath_data wpd; int i; nullpo_retz(md); nullpo_retz(bl); - dx = abs(bl->bl_x - md->bl_x); - dy = abs(bl->bl_y - md->bl_y); + dx = (bl->bl_x - md->bl_x); + dy = (bl->bl_y - md->bl_y); + rangex = abs(dx); + rangey = abs(dy); + arange = ((rangex > rangey) ? rangex : rangey); if (bl->bl_type == BL::PC && battle_config.monsters_ignore_gm == 1) { // option to have monsters ignore GMs [Valaris] @@ -1297,7 +1300,7 @@ int mob_can_reach(dumb_ptr<mob_data> md, dumb_ptr<block_list> bl, int range) if (md->bl_m != bl->bl_m) // 違うャbプ return 0; - if (range > 0 && range < ((dx > dy) ? dx : dy)) // 遠すぎる + if (range > 0 && range < arange) // 遠すぎる return 0; if (md->bl_x == bl->bl_x && md->bl_y == bl->bl_y) // 同じャX |