--- deliantra/server/include/util.h 2007/01/15 01:25:41 1.28 +++ deliantra/server/include/util.h 2007/01/15 01:50:33 1.30 @@ -60,10 +60,20 @@ ? (dx_ * 61685 + dy_ * 26870) >> 16 : (dy_ * 61685 + dx_ * 26870) >> 16; #else - return dx + dy - min (dx, dy) * 5 / 8; + return dx_ + dy_ - min (dx_, dy_) * 5 / 8; #endif } +/* + * absdir(int): Returns a number between 1 and 8, which represent + * the "absolute" direction of a number (it actually takes care of + * "overflow" in previous calculations of a direction). + */ +inline int +absdir (int d) +{ + return ((d - 1) & 7) + 1; +} // makes dynamically allocated objects zero-initialised struct zero_initialised