Page 1 of 1

Bug: yellow lamp but no trains assigned

Posted: Tue Feb 06, 2018 1:52 am
by wvlad
What could cause this?
Image

Re: Bug: yellow lamp but no trains assigned

Posted: Tue Feb 06, 2018 9:03 am
by Optera
This bug should have been fixed a few versions ago.
If you are still having it in 1.7.2 please enable debug logging and attach factorio-current.log.

Re: Bug: yellow lamp but no trains assigned

Posted: Tue Feb 06, 2018 11:05 am
by wvlad
Yes, the latest version. I debugged it and discovered that there is no such train scheduled. I think that the lamp color is not changed or delivery not removed from stop personal list when delivery is removed without train reaching station like timeout.

Re: Bug: yellow lamp but no trains assigned

Posted: Tue Feb 06, 2018 11:32 am
by wvlad
Just discovered that it's not an indication issue. Somehow (perhaps because of renaming with duplicating names) a lot of my stations had extra entries in stop.activeDeliveries. I fixed it by adding this to the end of UpdateStop

Code: Select all

    local name = stop.entity.backer_name
    local removed = false
    for i=#stop.activeDeliveries, 1, -1 do
        local d = global.Dispatcher.Deliveries[stop.activeDeliveries[i]]
        if (not d) or ((d.from~=name) and (d.to~=name)) then
            if message_level >= 1 then printmsg("Found missing delivery on station "..stop.entity.backer_name) end
            log("Found missing delivery on station "..stop.entity.backer_name)
            table.remove(stop.activeDeliveries,i)
            removed = true
        end
    end
    if removed and stop.errorCode == 0 then
      if #stop.activeDeliveries > 0 then
        setLamp(stopID, "yellow", #stop.activeDeliveries)
      else
        setLamp(stopID, "green", 1)
      end
    end
WIll you consider including it into the mod?

Re: Bug: yellow lamp but no trains assigned

Posted: Tue Feb 06, 2018 4:00 pm
by Optera
I removed something similar to this in 1.6 since i couldn't find a way to reproduce orphaned stop.activeDeliveries.

Instead of adding an extra loop to each stop update I'm more curious on how exactly you managed to produce this state so i can prevent it in the first place.

Re: Bug: yellow lamp but no trains assigned

Posted: Tue Feb 06, 2018 5:54 pm
by wvlad
This code prints a message immediately in such cases so I will let you know if I see it after some action.

Re: Bug: yellow lamp but no trains assigned

Posted: Tue Feb 06, 2018 6:06 pm
by Optera
I forgot to mention, the original fail safe code is only commented out from lines 1356 to 1360. https://github.com/Yousei9/Logistic-Tra ... .lua#L1355