News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

Wait time intervals are causing problems

Started by Yona-TYT, April 11, 2021, 11:07:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT

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 

prissi

Was this after saving? Simutrans cannot save these values yet.

Yona-TYT

no need to save, apparently you never get the correct values.

prissi

Sorry, then I do not get you error message. So you assign wait a value, which is changed?

Yona-TYT

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()+""
        }



Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

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. ;)

Dwachs

Parsley, sage, rosemary, and maggikraut.

Yona-TYT

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.  :-[

Dwachs

Some more functions still use uint8. Did not see this.
Parsley, sage, rosemary, and maggikraut.


Dwachs

Parsley, sage, rosemary, and maggikraut.

Yona-TYT