The International Simutrans Forum

 

Author Topic: Wait time intervals are causing problems  (Read 673 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1595
    • Simutrans-BLOG
  • Languages: ES
Wait time intervals are causing problems
« 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 

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10573
  • Languages: De,EN,JP
Re: Wait time intervals are causing problems
« Reply #1 on: April 12, 2021, 06:13:00 AM »
Was this after saving? Simutrans cannot save these values yet.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1595
    • Simutrans-BLOG
  • Languages: ES
Re: Wait time intervals are causing problems
« Reply #2 on: April 12, 2021, 11:18:30 AM »
no need to save, apparently you never get the correct values.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10573
  • Languages: De,EN,JP
Re: Wait time intervals are causing problems
« Reply #3 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?

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1595
    • Simutrans-BLOG
  • Languages: ES
Re: Wait time intervals are causing problems
« Reply #4 on: April 13, 2021, 09:11:14 AM »
Sorry, 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.
Code: [Select]
        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()+""
        }


Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4863
  • Languages: EN, DE, AT
Re: Wait time intervals are causing problems
« Reply #5 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.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1595
    • Simutrans-BLOG
  • Languages: ES
Re: Wait time intervals are causing problems
« Reply #6 on: April 13, 2021, 12:56:03 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. ;)

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4863
  • Languages: EN, DE, AT
Re: Wait time intervals are causing problems
« Reply #7 on: April 13, 2021, 06:04:06 PM »
should be fixed now

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1595
    • Simutrans-BLOG
  • Languages: ES
Re: Wait time intervals are causing problems
« Reply #8 on: April 13, 2021, 06:09:07 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.
Unfortunately, this does not solve the problem.  :-[

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4863
  • Languages: EN, DE, AT
Re: Wait time intervals are causing problems
« Reply #9 on: April 14, 2021, 07:18:07 AM »
Some more functions still use uint8. Did not see this.

Offline Andarix

  • *
  • Posts: 256
  • Languages: de

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4863
  • Languages: EN, DE, AT
Re: Wait time intervals are causing problems
« Reply #11 on: April 17, 2021, 11:40:40 AM »
please try with r9733 again

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1595
    • Simutrans-BLOG
  • Languages: ES
Re: Wait time intervals are causing problems
« Reply #12 on: April 18, 2021, 10:49:59 AM »
It works fine now, thank you very much! :)