The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Yona-TYT on April 11, 2021, 11:07:06 PM

Title: Wait time intervals are causing problems
Post by: Yona-TYT on April 11, 2021, 11:07:06 PM
I have run into inconsistencies when obtaining the values "wait" from "is_schedule_allowed", for example if the interval entered is "10570", the value obtained from "schedule.entries [nr] .wait" is "127" for some reason.  :o 
Title: Re: Wait time intervals are causing problems
Post by: prissi on April 12, 2021, 06:13:00 AM
Was this after saving? Simutrans cannot save these values yet.
Title: Re: Wait time intervals are causing problems
Post by: Yona-TYT on April 12, 2021, 11:18:30 AM
no need to save, apparently you never get the correct values.
Title: Re: Wait time intervals are causing problems
Post by: prissi on April 13, 2021, 07:06:36 AM
Sorry, then I do not get you error message. So you assign wait a value, which is changed?
Title: Re: Wait time intervals are causing problems
Post by: Yona-TYT on April 13, 2021, 09:11:14 AM
Quote from: prissi on April 13, 2021, 07:06:36 AMSorry, then I do not get you error message. So you assign wait a value, which is changed?
I leave you a minimum script to do tests, you just have to create an "Individual Schedule" and put a time interval like "2114", you will see a warning message like "Wait Time: 66 Name: Albacete - Stop Gas Station" Where wait time is the interval obtained from the schedule using script.
        local entrie = schedule.entries[0]
        if(entrie.wait){
            local halt   = entrie.get_halt( player_x(pl) )
            if (halt)
                return "Wait Time: "+entrie.wait+" Name: "+halt.get_name()+""
        }


Title: Re: Wait time intervals are causing problems
Post by: Dwachs on April 13, 2021, 12:48:27 PM
in api_schedule.cc (lines 67/68) the wait-parameter is read as signed 8 bit number, thus the truncation. Should be changed to uint16.
Title: Re: Wait time intervals are causing problems
Post by: Yona-TYT on April 13, 2021, 12:56:03 PM
Quote from: Dwachs on April 13, 2021, 12:48:27 PM
in api_schedule.cc (lines 67/68) the wait-parameter is read as signed 8 bit number, thus the truncation. Should be changed to uint16.
I'm going to try as soon as I get home. ;)
Title: Re: Wait time intervals are causing problems
Post by: Dwachs on April 13, 2021, 06:04:06 PM
should be fixed now
Title: Re: Wait time intervals are causing problems
Post by: Yona-TYT on April 13, 2021, 06:09:07 PM
Quote from: Dwachs on April 13, 2021, 12:48:27 PMin api_schedule.cc (lines 67/68) the wait-parameter is read as signed 8 bit number, thus the truncation. Should be changed to uint16.
Unfortunately, this does not solve the problem.  :-[
Title: Re: Wait time intervals are causing problems
Post by: Dwachs on April 14, 2021, 07:18:07 AM
Some more functions still use uint8. Did not see this.
Title: Re: Wait time intervals are causing problems
Post by: Andarix on April 14, 2021, 07:23:43 AM
@Dwachs

see https://www.simutrans-forum.de/mybb/showthread.php?tid=9379&pid=119556#pid119556 (https://www.simutrans-forum.de/mybb/showthread.php?tid=9379&pid=119556#pid119556)
Title: Re: Wait time intervals are causing problems
Post by: Dwachs on April 17, 2021, 11:40:40 AM
please try with r9733 again
Title: Re: Wait time intervals are causing problems
Post by: Yona-TYT on April 18, 2021, 10:49:59 AM
It works fine now, thank you very much! :)