diff options
author | wushin <pasekei@gmail.com> | 2015-09-19 21:22:53 -0500 |
---|---|---|
committer | wushin <pasekei@gmail.com> | 2015-09-19 21:22:53 -0500 |
commit | 3332fd62bda83d7e1f4e09bab2f61babf97a0fc1 (patch) | |
tree | 1760c3f9e93c5d01fefa392a738076535a6c2b63 /src/map/battle.cpp | |
parent | 05b13aab2a018f8a5a519a2f154fd2de123439ec (diff) | |
download | tmwa-3332fd62bda83d7e1f4e09bab2f61babf97a0fc1.tar.gz tmwa-3332fd62bda83d7e1f4e09bab2f61babf97a0fc1.tar.bz2 tmwa-3332fd62bda83d7e1f4e09bab2f61babf97a0fc1.tar.xz tmwa-3332fd62bda83d7e1f4e09bab2f61babf97a0fc1.zip |
Declaring abs for dx & dy caused latter equation to always be positive
Diffstat (limited to 'src/map/battle.cpp')
-rw-r--r-- | src/map/battle.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 5b63acc..589568b 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -2129,16 +2129,18 @@ int battle_check_range(dumb_ptr<block_list> src, dumb_ptr<block_list> bl, int range) { - int dx, dy; + int dx, dy, rangex, rangey; struct walkpath_data wpd; int arange; nullpo_retz(src); nullpo_retz(bl); - dx = abs(bl->bl_x - src->bl_x); - dy = abs(bl->bl_y - src->bl_y); - arange = ((dx > dy) ? dx : dy); + dx = (bl->bl_x - src->bl_x); + dy = (bl->bl_y - src->bl_y); + rangex = abs(dx); + rangey = abs(dy); + arange = ((rangex > rangey) ? rangex : rangey); if (src->bl_m != bl->bl_m) // 違うマップ return 0; |