Skip to content

Commit

Permalink
No reason to use the less clear implementation, is there?
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Feb 23, 2021
1 parent a81e70d commit 8729f07
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/map/location.cpp
Expand Up @@ -546,13 +546,9 @@ std::size_t distance_between(const map_location& a, const map_location& b)
{
const std::size_t hdistance = std::abs(a.x - b.x);

const std::size_t vpenalty = ( (((a.x & 1)==0) && ((b.x & 1)==1) && (a.y < b.y))
|| (((b.x & 1)==0) && ((a.x & 1)==1) && (b.y < a.y)) ) ? 1 : 0;

/* Don't want to include util.hpp in this header
const std::size_t vpenalty = ( (is_even(a.x) && is_odd(b.x) && (a.y < b.y))
|| (is_even(b.x) && is_odd(a.x) && (b.y < a.y)) ) ? 1 : 0;
*/

// For any non-negative integer i, i - i/2 - i%2 == i/2
// previously returned (hdistance + vdistance - vsavings)
// = hdistance + vdistance - minimum(vdistance,hdistance/2+hdistance%2)
Expand Down

0 comments on commit 8729f07

Please sign in to comment.