[Patch] Departure boards, 24h clock + binary 25 (r27452)

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Eddi
Tycoon
Tycoon
Posts: 8257
Joined: 17 Jan 2007 00:14

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

Post by Eddi »

Try Chill's Patch Pack.
User avatar
PC gamer
Traffic Manager
Traffic Manager
Posts: 213
Joined: 29 Feb 2008 06:28
Location: Estonia

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

Post by PC gamer »

Thanks!
Image
Logital82
Engineer
Engineer
Posts: 58
Joined: 15 Feb 2010 12:03
Location: Germany, Berlin

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

Post by Logital82 »

It is already together in Chills Patch Pack.

http://www.tt-forums.net/viewtopic.php?f=33&t=47622
Eddi
Tycoon
Tycoon
Posts: 8257
Joined: 17 Jan 2007 00:14

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

Post 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.
hthhs
Engineer
Engineer
Posts: 107
Joined: 03 Sep 2010 12:58
Location: London, UK

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

Post 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! :)
User avatar
Dwight_K._Schrute
Traffic Manager
Traffic Manager
Posts: 209
Joined: 01 Sep 2010 11:29

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

Post 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...
hthhs
Engineer
Engineer
Posts: 107
Joined: 03 Sep 2010 12:58
Location: London, UK

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

Post 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?
User avatar
Dwight_K._Schrute
Traffic Manager
Traffic Manager
Posts: 209
Joined: 01 Sep 2010 11:29

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

Post by Dwight_K._Schrute »

That would be the perfect approach for my special case :D

In 99% it will take one conditional orders branch ...
hthhs
Engineer
Engineer
Posts: 107
Joined: 03 Sep 2010 12:58
Location: London, UK

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

Post by hthhs »

Done - patch updated. I've added an advanced setting to choose how to handle conditional orders for departures.
User avatar
Norfolkadam
Engineer
Engineer
Posts: 77
Joined: 11 Jun 2010 19:16
Location: Norfolk, UK
Contact:

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

Post 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?
Helmland - The English and Danish island in the North Sea
User avatar
Dwight_K._Schrute
Traffic Manager
Traffic Manager
Posts: 209
Joined: 01 Sep 2010 11:29

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

Post 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.
User avatar
Norfolkadam
Engineer
Engineer
Posts: 77
Joined: 11 Jun 2010 19:16
Location: Norfolk, UK
Contact:

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

Post 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.
Helmland - The English and Danish island in the North Sea
User avatar
Dwight_K._Schrute
Traffic Manager
Traffic Manager
Posts: 209
Joined: 01 Sep 2010 11:29

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

Post 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??
User avatar
Norfolkadam
Engineer
Engineer
Posts: 77
Joined: 11 Jun 2010 19:16
Location: Norfolk, UK
Contact:

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

Post 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.
Helmland - The English and Danish island in the North Sea
User avatar
jvassie
Tycoon
Tycoon
Posts: 3421
Joined: 18 Dec 2002 18:00
Location: High Wycombe, England
Contact:

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

Post 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. :)
(British) Modular Stations Set - Thread: | Website:
Swiss Set - Thread: | Website:
Route Map Creator
My Screenshot Thread
User avatar
Lordmwa
President
President
Posts: 899
Joined: 20 May 2006 19:30
Location: West Sussex, England

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

Post 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?
The TT forums trivia tournament! Come along and join in the fun
http://www.funtrivia.com/private/main.cfm?tid=90722
Eddi
Tycoon
Tycoon
Posts: 8257
Joined: 17 Jan 2007 00:14

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

Post by Eddi »

you can't slow down the days with this patch. only the minutes, which have absolutely no gameplay effect.
User avatar
jvassie
Tycoon
Tycoon
Posts: 3421
Joined: 18 Dec 2002 18:00
Location: High Wycombe, England
Contact:

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

Post 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.
(British) Modular Stations Set - Thread: | Website:
Swiss Set - Thread: | Website:
Route Map Creator
My Screenshot Thread
User avatar
Lordmwa
President
President
Posts: 899
Joined: 20 May 2006 19:30
Location: West Sussex, England

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

Post by Lordmwa »

Oh ok Thanks for clearing that up
The TT forums trivia tournament! Come along and join in the fun
http://www.funtrivia.com/private/main.cfm?tid=90722
hthhs
Engineer
Engineer
Posts: 107
Joined: 03 Sep 2010 12:58
Location: London, UK

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

Post 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.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 12 guests