[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

User avatar
maselbe
Engineer
Engineer
Posts: 65
Joined: 13 May 2009 12:25

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

Post by maselbe »

hthhs wrote:Done.
Thanks. And I'm sorry if I sounded a bit like a whiner but it's just because I really like your patch. Thanks for the great work and the quick response(s).
Eddi
Tycoon
Tycoon
Posts: 8257
Joined: 17 Jan 2007 00:14

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

Post by Eddi »

i'm trying out this patch in Chill's PatchPack v12/r22273, and besides the issues i posted around here, i find some features missing.

1) the ability to slightly adjust timetable's start times forwards or backwards by a few minutes, to achieve better synchronisation. i once tried to set the time backwards for 5 minutes, but instead of getting 5 minutes late, the vehicle tried to wait 23h55m...

2) the ability to immediately fill out an estimate timetable by using speed and air distance.

3) the ability to easily spread start dates of shared vehicles [the ITiM patch had a great GUI showing all shared vehicles relative to their positions and space inbetwen. sadly, that was before the GUI rewrite, so it'll need lots of updating]
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: 1) the ability to slightly adjust timetable's start times forwards or backwards by a few minutes, to achieve better synchronisation. i once tried to set the time backwards for 5 minutes, but instead of getting 5 minutes late, the vehicle tried to wait 23h55m...
Yes, that's a bit annoying. I'll change it so that you can set a start time between (now - 1hr) and (now + 23hr).
2) the ability to immediately fill out an estimate timetable by using speed and air distance.
I think that would be better as a separate patch, to make it more likely to be included in trunk.
3) the ability to easily spread start dates of shared vehicles [the ITiM patch had a great GUI showing all shared vehicles relative to their positions and space inbetwen. sadly, that was before the GUI rewrite, so it'll need lots of updating]
IMHO, such functionality is beyond the scope of the patch, and can be done independently of it (e.g. automatic spreading by 60 days instead of 60 minutes).

Also, it sounds like it would take a lot of work for me to implement it, and I need to prepare for my finals in the coming months.
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 »

By the way. What are the chances for this patch to be included in trunk? Did you ever open a task on FlySpray??

This is after CargoDist the most important patch for me. Coul not imagine to play without the wallclock anymore. So thank you for that :)
hthhs
Engineer
Engineer
Posts: 107
Joined: 03 Sep 2010 12:58
Location: London, UK

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

Post by hthhs »

Hehe, I'm glad you like the patch. 8)

I haven't really thought much about trunk inclusion. My biggest concern is that adding another type of time like wallclock does would needlessly confuse new players. Also, the patch would probably have to be split into separate parts (departureboards and wallclock) again, and I haven't done that because it would complicate the patching process - they're no longer independent so would have to be applied in the correct order. I haven't opened a task on FlySpray.
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

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

Post by ChillCore »

Hi hthhs,

When you start a game in the year 2000000 the date seems to overflow which causes a crash afterwards...

With the ticks per minute set to 74 the date in the statusbar is as follows:
- in minute it toggles between "-2:-4 / January -65808" and "-2:-3 / August -65808"
- in days it toggles between "Sprite aligner Jan -65808" and "31st Aug -65808"

After a while of fast forward without actually doing anything else it crashes.

Code: Select all

Exception: E1212012
Location:  7B835A72
Message:   Assertion failed at line 53 of d:~\src\core/pool_type.hpp: index < this->first_unused
Crashfiles in attachment (zipped because crash.dmp is included also and only three files are allowed per post.)


Additional info ... maybe related, maybe not ... in my patchpack (reported by Wasila) it crashes here:

Code: Select all

Signal:  Aborted (6)
Message: NOT_REACHED triggered at line 181 of ~/src/strings.cpp
(Case 31 of "char *GetStringWithArgs(char *buffr, uint string, StringParameters *args, const char *last)" in case the line numbers do not correspond with your code ...)


In both cases the part where the date should be is empty at the moment of the crash, as you can see in the screenshot.



ps:
If you do not have 7z just let me now I'll redo it as zip then. ;)
Attachments
departures_v16_crash.7z
(141.35 KiB) Downloaded 209 times
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
hthhs
Engineer
Engineer
Posts: 107
Joined: 03 Sep 2010 12:58
Location: London, UK

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

Post by hthhs »

1000 hours in mspaint later and the patch has been updated. It now seems to work in the year 2000000. Binary will be updated shortly.
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

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

Post by ChillCore »

hthhs wrote: 1000 hours in mspaint later and the patch has been updated. It now seems to work in the year 2000000. Binary will be updated shortly.
Thank you for the quick fix hthhs.
I tested briefly and all seems to be fine now in regards of the date overflowing.


I noticed that now there is a small problem in the Advanced Settings due to some changes that you have made.
In the departure boards section there are some wrong values for the first three entries and changing one of them influence the previous one.
Also clicking "show vehicle name ..." and "show group name ..." both influence the first three entries.

I have fixed it in settings.ini by changing the values for "gui.max_departures", "gui.max_departure_time" and "gui.departure_calc_frequency" from INT32 to uint8.
None of these values have a max value that is higher than 255 so this should be fine.

Disclaimer:
I have not yet looked if these values need to be lowered somewhere else in the code.
I have not yet tested these changes ingame so I do not know if changing this creates other problems somewhere else.



Almost forgot,
Another thing that I noticed when testing your pre-compiled windows binary, when starting or exiting the game I get this warning ...

Code: Select all

ini: trailing characters at end of setting 'gui.date_with_time'
I do not know where this comes from as in my self-compiled version (Ubuntu) I do not see this warning.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
hthhs
Engineer
Engineer
Posts: 107
Joined: 03 Sep 2010 12:58
Location: London, UK

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

Post by hthhs »

Thanks for spotting those bugs! Will update the patch shortly. I'd absentmindedly forgotten to check the widths of the various settings matched up.

With regard to the mysterious error message from the win32 build: I forgot to mention that I'd changed one of the patch options! :oops:

Choosing whether to show the date along with the time is now configurable to show none/year/year and month/year and month and day, and has been changed from a bool to a uint8 to reflect this. For some reason you need to delete the entry from openttd.cfg to make it stop complaining :(
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

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

Post by ChillCore »

Thanks for spotting those bugs!
My pleasure.
With regard to the mysterious error message from the win32 build: I forgot to mention that I'd changed one of the patch options! :oops:

Choosing whether to show the date along with the time is now configurable to show none/year/year and month/year and month and day, and has been changed from a bool to a uint8 to reflect this. For some reason you need to delete the entry from openttd.cfg to make it stop complaining :(
Strange and somewhat inconvenient ...
Then again OpenTTD does not remove old (no longer used) settings. That is what makes it is possible to have one config file for all installed versions. (Including older or clean versions that do not have a specific setting.)
IMHO no big problem and not really an issue as long as it does not happen in clean trunk once your patch gets included, hopefully someday ;)
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

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

Post by ChillCore »

Hello hthhs,
For your patch to display the correct background colour in the departures gui (with current trunk) a minor adjustment is needed.

Code: Select all

	/* Draw the black background. */
-	GfxFillRect(r.left + 1, r.top, r.right - 1, r.bottom, 0xD7);
+	GfxFillRect(r.left + 1, r.top, r.right - 1, r.bottom, PC_BLACK);
Before I made this change in my patchpack the background was pink. ;)
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
hthhs
Engineer
Engineer
Posts: 107
Joined: 03 Sep 2010 12:58
Location: London, UK

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

Post by hthhs »

Patch updated. Thank you!
classics_prof
Engineer
Engineer
Posts: 36
Joined: 21 Jan 2011 17:45

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

Post by classics_prof »

This patch is so remarkably brilliant, it should be in Trunk. So says I... :)
hthhs
Engineer
Engineer
Posts: 107
Joined: 03 Sep 2010 12:58
Location: London, UK

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

Post by hthhs »

Patch updated. New feature: don't show termini that can be reached sooner on a later vehicle.

Explanation: suppose there are fast and stopping trains to Cambridge from King's Cross, and furthermore that the stopping service leaves before the fast one but arrives into Cambridge later than the fast one. Passengers travelling to Cambridge would therefore be better off waiting to get the fast service. If the patch setting is enabled, instead of both trains being listed as going to Cambridge, they would be shown as the following:

15:06 Foxton
Finsbury Park, Potters Bar, Hatfield, Welwyn Garden City, Welwyn North, Knebworth, Stevenage, Hitchin, Letchworth Garden City, Baldock, Ashwell And Morden, Royston, Meldreth, Shepreth and Foxton. This train continues to Cambridge.
15:15 Cambridge
Calling at: Cambridge.

Edit: bug fixed. For some reason I don't write very good code at 1am.
Eddi
Tycoon
Tycoon
Posts: 8257
Joined: 17 Jan 2007 00:14

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

Post by Eddi »

i honestly don't see the sense of this feature...
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

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

Post by Leanden »

Neither do i, think it'd be better off just having Cambridge tagged on the end of the list of destinations. With Cargodist, i think that passengers going to Cambridge would wait for the fast train anyway. Other than that though, i love the patch and can't wait to see it come into trunk if the developers allow it.

Is the code pretty tidy?
Image
hthhs
Engineer
Engineer
Posts: 107
Joined: 03 Sep 2010 12:58
Location: London, UK

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

Post by hthhs »

It's just eyecandy, like the rest of the patch (and can be disabled!). Some stations in the UK (e.g. King's Cross) do it, so I decided to replicate the behaviour.

The code was tidy, once upon a time... :oops:
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

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

Post by Leanden »

Is there any particular area that would need tidying to get it back in line with requirements for trunk inclusion, as i understand they are very strict on those things.
Image
hthhs
Engineer
Engineer
Posts: 107
Joined: 03 Sep 2010 12:58
Location: London, UK

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

Post by hthhs »

Patch updated to r23082.
Leanden wrote:Is there any particular area that would need tidying to get it back in line with requirements for trunk inclusion, as i understand they are very strict on those things.
The biggest problem with it (IMO) is that the main algorithm for computing departures started out small and neat, but has since had lots of changes and additional features hacked into it, so now it's a bit of a mess.
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

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

Post by supermop »

Ah, thats too bad - this is my single most valued patch!
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 20 guests