Minor bug: enhancetunnels and steam engines

Got a problem with TTDPatch? Get help here.

Moderator: TTDPatch Moderators

Post Reply
User avatar
Dropzone
Traffic Manager
Traffic Manager
Posts: 178
Joined: 04 Apr 2005 21:38
Location: North Lincs., UK

Minor bug: enhancetunnels and steam engines

Post by Dropzone »

When a steam engine passes over an enhanced tunnel entrance, it temporarily stops producing steam (see the attached screenshot). Obviously that's supposed to happen if a steam engine goes into a tunnel entrance, but not if it goes over the top of one. I'd guess the original TTD code stops engines steaming whenever they're on the same tile as a tunnel entrance, which isn't correct any more now that we have enhancetunnels. I'm using r1582, Windows version, and the bug happens even with no GRFs activated. I've attached my config file, as well as a save demonstrating the bug.
Attachments
TRP04.SV1
(82.94 KiB) Downloaded 119 times
ttdpatch.cfg
(37.01 KiB) Downloaded 102 times
steambug.png
steambug.png (5.06 KiB) Viewed 2321 times

User avatar
m3henry
Tycoon
Tycoon
Posts: 1985
Joined: 15 Feb 2006 12:00
Location: Hampshire

Post by m3henry »

this happens with me, and I'm sure it happens with everybody else who uses this feature.
The occasional look back at your past can teach you a great many things...

User avatar
Dropzone
Traffic Manager
Traffic Manager
Posts: 178
Joined: 04 Apr 2005 21:38
Location: North Lincs., UK

Post by Dropzone »

Well, hopefully it won't happen for much longer, because I managed to figure out enough assembly to fix it myself. I've attached a diff of procs/tunbridg.asm and patches/tunbridg.asm against the r1584 versions, as well as the save that I used for a test case (note that I haven't tested under DOS). My code adds an extra check so that, when a steam train is on a tunnel tile, it only stops steaming if it's oriented in the same direction as the tunnel. Could a dev please check whether the code looks okay, and if it does, commit it?
Attachments
steampatch.png
steampatch.png (11.03 KiB) Viewed 2270 times
TRP05.SV1
(86.79 KiB) Downloaded 113 times
tunnelsteamcheck.diff
(1.3 KiB) Downloaded 132 times

User avatar
JGR
Tycoon
Tycoon
Posts: 2016
Joined: 08 Aug 2005 13:46
Location: Ipswich

Post by JGR »

TTDP with your diff is compiling right now, and then I'm going to do some tests...
I'll also see if the DOS code and windows code are the same (they probably are).
The code looks very good at a glance and I'll say well done, (and very fast as well). :)
I'll probably commit it soon if I don't find any issues...

JGR

User avatar
Ameecher
Tycoon
Tycoon
Posts: 11910
Joined: 12 Aug 2006 15:39
Location: MK UK
Contact:

Post by Ameecher »

Is this another patch developer in the making? Haven't tested it yet DropZone but I'll say good work anyway :)
Image

User avatar
JGR
Tycoon
Tycoon
Posts: 2016
Joined: 08 Aug 2005 13:46
Location: Ipswich

Post by JGR »

Slight problem with fragments...
In DOS version steam plume code is before aircraft broken down smoke, and opposite way in windows version, and this may lead to problems.
So I'm widening the search fragment a bit, to avoid any ambiguity.

I can spot no problems at all in the actual code and it passes all of my tests.

I will be committing it shortly.

You clearly know what you are doing with assembly and how the patch works, so you could probably "join the team" so to speak and become an official patch dev if you want and keep up the great work...

JGR

User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1804
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Post by Lakie »

Have you check that any fragments respect that the placement of train, road vehicle, ships and aircraft code varies from Windows to DOS?
I remember there are differences in the order that they are in.

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."

User avatar
JGR
Tycoon
Tycoon
Posts: 2016
Joined: 08 Aug 2005 13:46
Location: Ipswich

Post by JGR »

There is only one instance of the fragment I used, in both the DOS and windows versions, and so these issues largely go away.
The initial fragment by DropZone was one instruction shorter and was present in both the steam plume and aircraft broken-down smoke code, which were in a different order between the two versions.

The fragment now as far as I can tell is OK, and should work fine on any version. I haven't tested it on DOS though.

The only fragment I've added for enhanced tunnels is quite long and only found in one place. (GetTunnelOtherEnd hook)
All the other enhanced tunnel fragments are Oskar's, and I trust that he got them right :wink:

JGR

Post Reply

Return to “Problems with TTDPatch”

Who is online

Users browsing this forum: No registered users and 3 guests