ID:97991
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
"At this time, get_dist() never returns a value greater than 127. " - the ref

As far as I know, get_dist is one of the few functions that is still limited to 127.
Seeing as things can be greater then 127 tiles away, I believe this procedure should be enhanced to allow the returning of a value greater than 127.
proc/GetDist(var/atom/A1,var/atom/A2)
var/xDist
if(A1.x>A2.x) xDist=A1.x-A2.x
else xDist=A2.x-A1.x

var/yDist
if(A1.y>A2.y) yDist=A1.y-A2.y
else yDist=A2.y-A1.y

return max(xDist,yDist)
Why would I add something, when such a feature already exists in BYOND, but is limited?

Falacy wrote:
> proc/GetDist(var/atom/A1,var/atom/A2)
> var/xDist
> if(A1.x>A2.x) xDist=A1.x-A2.x
> else xDist=A2.x-A1.x
>
> var/yDist
> if(A1.y>A2.y) yDist=A1.y-A2.y
> else yDist=A2.y-A1.y
>
> return max(xDist,yDist)
>

Super Saiyan X wrote:
Why would I add something, when such a feature already exists in BYOND, but is limited?

Your question pretty much answers itself.
Honestly, I don't even need use said function at the moment. I don't need a workaround if I don't need to use it. I'm just suggesting that get_dist be expanded to allow the returning of greater values. Srsly.
Something strange I just noticed o.O
If you get_dist() to the same object it returns -1, but if you get_dist() to different objects in the same place it returns 0.
Simpler:
proc/GetDist(var/atom/A1, var/atom/A2)
return max(abs(A1.x-A2.x), abs(A1.y-A2.y))
This came up in conversation so I'm going to bump this. Absolutely idiotic limit. The -1 returns are also weird and should be looked at.
Shouldn't be any limit, we should be able to bring our project down in a glory of flames if we want to. Remove the limit or feel our silent wrath.
Workarounds are not the solution though, because they're worse in performance than get_dist(). Maybe we should really get the enhancement
In response to Vallat
Vallat wrote:
Workarounds are not the solution though, because they're worse in performance than get_dist(). Maybe we should really get the enhancement

Just to pile on, the manual workaround is 10x slower than get_dist(). Half of that is just the proc invocation overhead. If you drop that into a macro, it's unsafe and only 5x slower.
bumping this, would be great for 514
+1

Really weird that this is still a thing