Page 9 of 15

Re: [Patch] Departure boards, 24h clock + binary

Posted: 24 Jan 2011 17:50
by Eddi
Try Chill's Patch Pack.

Re: [Patch] Departure boards, 24h clock + binary

Posted: 24 Jan 2011 19:08
by PC gamer
Thanks!

Re: [Patch] Departure boards, 24h clock + binary

Posted: 25 Jan 2011 10:20
by Logital82
It is already together in Chills Patch Pack.

http://www.tt-forums.net/viewtopic.php?f=33&t=47622

Re: [Patch] Departure boards, 24h clock + binary

Posted: 27 Jan 2011 20:59
by Eddi
i found a problem in the code. in this section in departures_gui.cpp:

Code: Select all

	/* Find the maximum possible width of the departure time and "Expt <time>" fields. */
	SetDParam(0, INT_MAX);
	int time_width = (departure_types[0] && departure_types[1]) ? (GetStringBoundingBox(STR_DEPARTURES_TIME_DEP)).width : (GetStringBoundingBox(STR_DEPARTURES_TIME)).width;

	if (_settings_client.gui.departure_show_both) {
		SetDParam(0, INT_MAX);
		SetDParam(1, INT_MAX);
		time_width = GetStringBoundingBox(STR_DEPARTURES_TIME_BOTH).width;
	}
you set the DParam to INT_MAX to find out how wide the time is going to be. the problem is, INT_MAX will not necessarily result in the widest possible time, so some times will be cut off. if you set the parameter to 0, it seems to behave better.

a more sophisticated approach would be to loop through all digits (0..9) to find out which time from 00:00 to 99:99 will be the widest. this value may be cached, but the effect is probably negligible.

Re: [Patch] Departure boards, 24h clock + binary

Posted: 29 Jan 2011 18:59
by hthhs
Eddi wrote:INT_MAX will not necessarily result in the widest possible time
Cool. I've updated the patch - the problem should now be fixed (please tell me if you find it isn't.) Thanks for spotting it! :)

Re: [Patch] Departure boards, 24h clock + binary

Posted: 30 Jan 2011 10:11
by Dwight_K._Schrute
Hey hthhs,

I still enjoy playing with your patch a lot. But yesterday I noticed something which has not been mentioned or discussed in this thread yet, iirc.

I wanted to set up some conditional orders for my vehicles that they only go to depot if the are old enough to auto-renew. So some trains go only to depot every ~40 years. Departure times are not really affected by this order.

But Departure Board don't shows departures anymore.

I don't know if there is a solution for this. But I thought I mention it once. Sorry if that has happened before...

Re: [Patch] Departure boards, 24h clock + binary

Posted: 30 Jan 2011 12:34
by hthhs
Unfortunately determining whether a conditional order branch will be taken is in general undecidable. :(

The patch currently uses the same approach as the timetable window - it gives up when it encounters a conditional order. (This behaviour is completely by accident, as it happens :oops:)

One thing I could do would be to always assume a conditional order branch will be taken, then if you have e.g. goto A (30 mins), goto B (30 mins), jump to order 1 when age < 15, goto depot (60 mins) it would be handled correctly except when the vehicle is 15 or more years old. How does that sound?

Re: [Patch] Departure boards, 24h clock + binary

Posted: 30 Jan 2011 12:39
by Dwight_K._Schrute
That would be the perfect approach for my special case :D

In 99% it will take one conditional orders branch ...

Re: [Patch] Departure boards, 24h clock + binary

Posted: 30 Jan 2011 14:32
by hthhs
Done - patch updated. I've added an advanced setting to choose how to handle conditional orders for departures.

Re: [Patch] Departure boards, 24h clock + binary

Posted: 10 Feb 2011 10:48
by Norfolkadam
I absolutely love this patch but there're just two questions I have.

1. What is 1 tick equal to? I thought it was a second but then that didn't quite work out. I was trying to create "clockface" timetables where trains leave every hour or every two hours but I've not quite got it yet.

2. When you set a station to "no unloading" it doesn't show on the "Calling at:" section. Can you add an option so that it does?

Re: [Patch] Departure boards, 24h clock + binary

Posted: 10 Feb 2011 10:59
by Dwight_K._Schrute
Can only agree with Norfolkadam.. and thank you for making nearly every wish come true ever posted in this thread :lol:
1. What is 1 tick equal to? I thought it was a second but then that didn't quite work out. I was trying to create "clockface" timetables where trains leave every hour or every two hours but I've not quite got it yet.
1 tick is equal to 30 ms. If you play without daylength factor 1 day = 74 ticks. I play my actual game with 120 ticks / minute, so I have 2 ticks = 1 gamesecond.
When you set a station to "no unloading" it doesn't show on the "Calling at:" section. Can you add an option so that it does?
Why should it show this station? I think it would not be fair to your customer ;) He thinks the train is calling at XY but when he is arriving ther he can not leave the train ;)

Why don't you use the VIA-option? Just give it a via-order (or do you want to load?) and you have the option to show that in the departure board.

Re: [Patch] Departure boards, 24h clock + binary

Posted: 10 Feb 2011 11:17
by Norfolkadam
Dwight_K._Schrute wrote:Can only agree with Norfolkadam.. and thank you for making nearly every wish come true ever posted in this thread :lol:
1. What is 1 tick equal to? I thought it was a second but then that didn't quite work out. I was trying to create "clockface" timetables where trains leave every hour or every two hours but I've not quite got it yet.
1 tick is equal to 30 ms. If you play without daylength factor 1 day = 74 ticks. I play my actual game with 120 ticks / minute, so I have 2 ticks = 1 gamesecond.
When you set a station to "no unloading" it doesn't show on the "Calling at:" section. Can you add an option so that it does?
Why should it show this station? I think it would not be fair to your customer ;) He thinks the train is calling at XY but when he is arriving ther he can not leave the train ;)

Why don't you use the VIA-option? Just give it a via-order (or do you want to load?) and you have the option to show that in the departure board.
So that would mean 1 minute is 1998 ticks ((1000/30)*60) and 1 hour is 119880 (1998*60) ticks which can't be right unless you're talking about real time and not in-game departure clock time.

I know it wouldn't be fair on the passenger but I use a lot of single-track, rural routes where the trains won't make any profit if they unload at every station so I use "no unloading" at the intermediate stations to get the train full to unload at the terminus or a major stop. Not terribly realistic but it gives the illusion of realism and I'd like that to be shown. If I did a "via" order it wouldn't load so there'd be no point.

Thanks for your help so far.

Re: [Patch] Departure boards, 24h clock + binary

Posted: 10 Feb 2011 11:37
by Dwight_K._Schrute
I think I don't get your point. But I'll try again :)

1 tick = 30 (real)ms

1 OpenTTD-day = 74 ticks

1 (game) minute takes as long as you set in the adcanced settings. Standard is here: 74 ticks / (game)minute. So one original TTD-day will be one (game)minute if you don't change anything.

So do you want to play in REAL time? One train every hour??

Re: [Patch] Departure boards, 24h clock + binary

Posted: 10 Feb 2011 11:42
by Norfolkadam
Dwight_K._Schrute wrote:I think I don't get your point. But I'll try again :)

1 tick = 30 (real)ms

1 OpenTTD-day = 74 ticks

1 (game) minute takes as long as you set in the adcanced settings. Standard is here: 74 ticks / (game)minute. So one original TTD-day will be one (game)minute if you don't change anything.

So do you want to play in REAL time? One train every hour??
Right I'm with you now. So 74 ticks = 1 minute on the game's 24h clock. I didn't know you could change the settings for that so I think that's where the confusion lay. Thanks for that.

Re: [Patch] Departure boards, 24h clock + binary

Posted: 10 Feb 2011 16:59
by jvassie
Norfolkadam wrote:
Dwight_K._Schrute wrote:I think I don't get your point. But I'll try again :)

1 tick = 30 (real)ms

1 OpenTTD-day = 74 ticks

1 (game) minute takes as long as you set in the adcanced settings. Standard is here: 74 ticks / (game)minute. So one original TTD-day will be one (game)minute if you don't change anything.

So do you want to play in REAL time? One train every hour??
Right I'm with you now. So 74 ticks = 1 minute on the game's 24h clock. I didn't know you could change the settings for that so I think that's where the confusion lay. Thanks for that.
Indeed, so a game minute = 74 ticks * 30ms = 2220ms = 2.22 real seconds

If you wish to slow the game down, increase the ticks, if you wish to speed it up, decrease the ticks. :)

Re: [Patch] Departure boards, 24h clock + binary

Posted: 10 Feb 2011 22:14
by Lordmwa
So if you slow down the game so a day takes twice as long does that mean trains reach their destination twice as fast game wise but only half the goods are produced?

Re: [Patch] Departure boards, 24h clock + binary

Posted: 11 Feb 2011 07:48
by Eddi
you can't slow down the days with this patch. only the minutes, which have absolutely no gameplay effect.

Re: [Patch] Departure boards, 24h clock + binary

Posted: 11 Feb 2011 08:24
by jvassie
But it does help in cases where for example at a busy station you need to get 10+ trains per hour leaving, and at the current setting it can take 6 'minutes' to cross just the station throat. So slowing the minutes down will mean you get more 'actual time' to get the trains out, knowing that trains leave at xx:05, etc.

Re: [Patch] Departure boards, 24h clock + binary

Posted: 11 Feb 2011 11:54
by Lordmwa
Oh ok Thanks for clearing that up

Re: [Patch] Departure boards, 24h clock + binary

Posted: 11 Feb 2011 20:17
by hthhs
Norfolkadam wrote:When you set a station to "no unloading" it doesn't show on the "Calling at:" section. Can you add an option so that it does?
Done.

I've also updated the patch to current trunk, and handled automatic orders as best I can.