Page 1 of 1

requested items out of bounds

Posted: Fri Mar 20, 2020 12:35 pm
by Zanostra
Error while running event LogisticTrainNetwork::on_train_changed_state (ID 23)
Value (2147483648.000000) outside of range. The data type allows values from -2147483648 to 2147483647 in property tree at ROOT[4].count
stack traceback:
__LogisticTrainNetwork__/script/stop-update.lua:508: in function 'UpdateStopOutput'
__LogisticTrainNetwork__/script/train-events.lua:100: in function 'TrainArrives'
__LogisticTrainNetwork__/script/train-events.lua:199: in function <__LogisticTrainNetwork__/script/train-events.lua:195>
stack traceback:
[C]: in function '__newindex'
__LogisticTrainNetwork__/script/stop-update.lua:508: in function 'UpdateStopOutput'
__LogisticTrainNetwork__/script/train-events.lua:100: in function 'TrainArrives'
__LogisticTrainNetwork__/script/train-events.lua:199: in function <__LogisticTrainNetwork__/script/train-events.lua:195>

I have a provider station for landfill, wich use filter inserters, all works well, no problems there.
I drove a train manually, so the train does not get filled automatically, so I added the station in the train shedule.
It only loads landfill if the train gives set filter to the providing station, but I didn't want to calculate, and I wanted the train to be absolutely full, AND not moving after done filling up.
So I set the condition landfill > 13545615313 ( random very very high number ), showing a G.x number, to be sure the condition would never be met, so the train would never leave so I could come there later and the train would be there for me.
I didn't see the timing, but I assume ( since the on_train_changed_state error ) the game crashed when the train arrived at that station.
I think I uploaded the right factorio-current.

Re: requested items out of bounds

Posted: Fri Mar 20, 2020 4:57 pm
by Optera
Reading through your steps to reproduce it seemed odd this error suddenly popped up now in code that was untouched for over a year.
Turns out the recent ui changes allow for numbers outside 32bit int range, earlier versions would cap positive numbers at 2147483647.

Re: requested items out of bounds

Posted: Fri Mar 20, 2020 5:00 pm
by Bilka
Optera wrote: Fri Mar 20, 2020 4:57 pm Reading through your steps to reproduce it seemed odd this error suddenly popped up now in code that was untouched for over a year.
Turns out the recent ui changes now allow for numbers outside 32bit int range, earlier versions would cap positive numbers at 2147483647.
Which GUI is this?

Re: requested items out of bounds

Posted: Fri Mar 20, 2020 5:01 pm
by Optera
Going by op description that should be Train waiting condition item > n

Edit:
Now i see what happened.... it's a 1 off error from > n while in ltn usually uses >=
I had some really old legacy code in place from a time before we had >= conditions. I guess removing that legacy code will be the cleanest way to fix, since I don't even support directly migrating from such ancient LTN versions.

So it seems no one tried that in the last year. :o

Re: requested items out of bounds

Posted: Fri Mar 20, 2020 6:29 pm
by dockmeister
I cannot test it right now, but i ran into this a couple month back.

Code: Select all

https://lua-api.factorio.com/latest/LuaControlBehavior.html#LuaConstantCombinatorControlBehavior.set_signal
I think this method is very picky and only accepts signed int 32

Re: requested items out of bounds

Posted: Fri Mar 20, 2020 6:30 pm
by Zanostra
:P I'm always doing strange stuff,
but it seems like it is fixed,
I didn't use the exact same train, but I tried all kind of 'out of bound' conditions, and there was no crash anymore. :D