OpenTTD

Tasklist

FS#4774 - patch: autoconvert

Attached to Project: OpenTTD
Opened by Círdan (cirdan) - Wednesday, 14 September 2011, 18:46 GMT
Type Patch
Category Vehicles → Autoreplace
Status New
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No

Details

I would like to submit my autoconvert patch for inclusion in trunk.

This patch series implements the following two features:

a) Allow to define per-railtype replacements for a rail engine.

With the patch, an engine can have a "default" global replacement (which is the current situation) and then a particular replacement for each railtype in the game. When a train enters a depot and is checked for autoreplace, the replacements are searched using the depot's railtype first, falling back to the global list if there is none (thus preserving backwards compatibility).

A first use of this feature would be to specify different replacements for an engine; for instance, a diesel engine can be set to be replaced by an electric engine if it is running on track that has already been electrified, or by another diesel engine otherwise.

b) Allow to use the convert tool on depots with trains.

When rail conversion is attempted on a depot, trains inside are checked for replacements using the target railtype replacement list; if all of the vehicles can be successfully replaced, the depot is converted. (Otherwise, the usual "train in the way" error is thrown.)
This task depends upon

Comment by crocodile (crocodile) - Saturday, 15 October 2011, 10:41 GMT
Thank you for your patch. But I've found some issues with it.

Firstly, game crashes when I try to autochange any vehicles other than trains. You can try it in attached savegame.

Secondly, my tortoisesvn can't patch using your file, I had to convert it so it could use it. (it's not a bug, it's just a minor inconvenience)
Comment by crocodile (crocodile) - Saturday, 15 October 2011, 15:38 GMT
Another problem I ran into:
If you try to autoconvert depo with carriages, which are not connected to anything, game crashes
Comment by Círdan (cirdan) - Thursday, 27 October 2011, 17:39 GMT
Thanks for the report, and sorry for the delay--I don't check the bugtracker very often.

> Firstly, game crashes when I try to autochange any vehicles other than trains. You can try it in attached savegame.

There was no need for a savegame: the program crashes as soon as you try to access the autoreplace UI for any vehicle type other than trains, so it was easy to reproduce. The attached patch should fix this.

> If you try to autoconvert depo with carriages, which are not connected to anything, game crashes

Hmm, I have a specially prepared savegame that I use as a test, which includes free wagons in a depot, and indeed does it crash. I wonder why I didn't catch this earlier... Anyway, it should also be fixed now.

> Secondly, my tortoisesvn can't patch using your file, I had to convert it so it could use it. (it's not a bug, it's just a minor inconvenience)

This is a known issue with tortoisesvn: it chokes on patches unless they have a very specific format. But I can't help you with that because I don't use tortoisesvn.

Loading...