[0.9.6] Scripting, findnoncollidingposition returns 1.7e+308

This subforum contains all the issues which we already resolved.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

[0.9.6] Scripting, findnoncollidingposition returns 1.7e+308

Post 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
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.9.6] Scripting, findnoncollidingposition returns 1.7e

Post 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.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: [0.9.6] Scripting, findnoncollidingposition returns 1.7e

Post 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
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.9.6] Scripting, findnoncollidingposition returns 1.7e

Post by kovarex »

Fixed for 0.9.7
Post Reply

Return to “Resolved Problems and Bugs”