Page 1 of 1

[0.9.6] Scripting, findnoncollidingposition returns 1.7e+308

Posted: Mon Mar 31, 2014 8:36 pm
by FreeER
I was just using findnoncollidingposition with a maxperimeter of 30 to create an entity at a random location and on occasion found it returning {x=1.7976931348623e+308, y=1.7976931348623e+308}...I also (due to a debug statement) found myself teleported to that 'position' and saw a couple interesting effects (no character and a blinking screen, or maybe that was just the zoom going crazy, I couldn't control that either) :lol:

My guess is that somehow this is what is returned when it fails to find a noncollidingposition (I changed the max perimeter to be 1000 and didn't see it again after multiple tests)...I think it would be preferable if it returned nil when it fails :D

Re: [0.9.6] Scripting, findnoncollidingposition returns 1.7e

Posted: Mon Mar 31, 2014 10:19 pm
by kovarex
This is an side effect, of us using the std::numeric_limits<double>::max() coordinates for emptyPosition internally ...
I will fix it, so it will return nil when the position wasn't found.

Re: [0.9.6] Scripting, findnoncollidingposition returns 1.7e

Posted: Mon Mar 31, 2014 10:32 pm
by FreeER
kovarex wrote: This is an side effect, of us using the std::numeric_limits<double>::max() coordinates for emptyPosition internally ...
That does not surprise me, I thought it was an underflow being caused by an mistaken multiplication somewhere, but didn't find one (and non of the values could come anywhere close to large enough on their own) so I kind of assumed it was being set to a max size somewhere internally (obviously that of a double since it wasn't an integer) upon failure.
kovarex wrote:I will fix it, so it will return nil when the position wasn't found.
Thank you :D

Re: [0.9.6] Scripting, findnoncollidingposition returns 1.7e

Posted: Tue Apr 01, 2014 8:53 am
by kovarex
Fixed for 0.9.7