FS#739 - Game crashes when cloning trains.

Attached to Project: OpenTTD
Opened by Bleh7777 (kevmo314) - Saturday, 21 April 2007, 02:06 GMT
Type Bug
Category Vehicles → Clone vehicles
Status Closed
Assigned To Bjarni (Bjarni)
Operating System Windows
Severity Critical
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The game crashes when I attempt to clone a train, specifically "SH '125' (Diesel)" with and without cloning shared orders.

Using revision r9692.

Steps to reproduce:

1. Set year to 2000.
2. Build a rail depot.
3. Create an SH '125' Diesel engine with 12 passenger cars.
4. Clone the vehicle.

I've attached the crash.log file, and I've also attached the save game where I discovered this, but I was able to reproduce it, so it shouldn't be necessary.
This task depends upon

Closed by  Jonathan Coome (Maedhros)
Sunday, 29 April 2007, 08:46 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in r9742.
Comment by Jonathan Coome (Maedhros) - Monday, 23 April 2007, 18:54 GMT
In the case of the SH 125, this is due to vehicle.cpp:1882. For multiheaded vehicles w2->next is the other half of the vehicle, but v2->next is the carriage after the first vehicle, so the cargo types of completely different vehicles are being compared.

It also appears to break with articulated vehicles from the Czech set, too, although this may be for a different reason: