FS#5866 - Assertion failure in command.cpp when converting sections of rail

Attached to Project: OpenTTD
Opened by Jo (efess) - Tuesday, 14 January 2014, 18:19 GMT
Last edited by fonsinchen (fonsinchen) - Sunday, 02 February 2014, 14:55 GMT
Type Bug
Category Core
Status Closed
Assigned To No-one
Operating System Windows
Severity High
Priority Normal
Reported Version 1.4.0-beta2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


OS: Windows 7 N

Assertion failure while converting rail from one type to another. This happened while using the NUTS trainset - converting red purr to green purr. I've seen this crash with nutracks as well.

This save uses GRFs from bananas and the openttd-coop pack (

Reproducible - load the original save, change rail type to Green purr, convert the rail in the same manner as in the screenshot.
This task depends upon

Closed by  fonsinchen (fonsinchen)
Sunday, 02 February 2014, 14:55 GMT
Reason for closing:  Fixed
Additional comments about closing:  In r26291
Comment by Alberth (Alberth) - Tuesday, 14 January 2014, 21:56 GMT
What save are you talking about?
That wiki page only discusses the grf pack, no NUTS, no screenshot, no mentioning of Purr, no converting of tracks.
Comment by Jo (efess) - Tuesday, 14 January 2014, 23:17 GMT
Sorry, not sure why the files didn't attach. Trying again. One of the attachments is "Original.sav" which is the save state before the crash.
Comment by Grzegorz DuczyƄski (adf88) - Thursday, 16 January 2014, 14:27 GMT
I found the bug and fixed it. In CmdConvertRail there is a check: "If both ends of tunnel/bridge are in the range, do not try to convert twice it would cause assert because of different test and exec runs" ( But that check is always orthogonal (never diagonal).
Comment by Jo (efess) - Saturday, 01 February 2014, 14:43 GMT
Tested against 26275 - this patch fixes the issue.
Comment by fonsinchen (fonsinchen) - Saturday, 01 February 2014, 17:33 GMT
I think we should add a DiagonalTileArea implementation at this point. Rumour has it that there is such a thing somewhere. If anyone can supply me with a patch I will happily review it.
Comment by Jo (efess) - Saturday, 01 February 2014, 20:04 GMT
-deleted- ..refreshing posts the comment again. Noted.