Basically I think your new window can replace the existing window entirely. The functionality of the existing window is then integrated in your new window.
Maybe my suggestion will be more clear with some examples:
- Replace steam train with electric train: If the steamers enters an electrified depot it is replaced immediately and released back out of it. If it enters a non-electrified depot, the train is not replaced, the user is informed of that by a message and the train is released back out unchanged.
I am not sure we want to pester the user with a message in that case; perhaps they set up the replacement just for a part of their network and don't want to be annoyed about the unelectified rest. Otherwise, fine.
- Replace train with maglev: same as the unchanged steam train; vehicle enters depot and is not changed because of incompatible depot.
(We certainly don't want a message in this case. If a user sets up a maglev replacement for a steamer, they should know pretty well it will not happen on its own.)
- If you want to replace train with maglev: stop the train in the depot and then convert the depot to maglev. The train will now be converted to maglev by your patch.
- If you want to replace steam train to electric in non-electric depot: stop the train in the depot and then convert the depot.
So basically: if the depot is compatible, the train is converted immediately. If the depot is incompatible, you must stop the train in the depot and convert the depot to also convert the trains inside. If there is no rule set up to convert the train in the depot, the error message is shown.
This doesn't handle multiple replacement types yet, but that could work as follows:
If multiple replacement types are possible inside a depot, the first available replacement type (using the order of railtypes in the list) is used.
You need something like that anyways in your current patch. Imagine I set train type A to be replaced with monorail type B and maglev type C. I stop the train in a normal train depot. Now I convert the depot to the "universal railtype" that can handle trains, monorails and maglevs. What replacement must be used in this case?
Fine, I now get your point. Overall, it could be an improvement. Regarding the fact that a vehicle type can have several simultaneous replacements depending on the target rail type, I think it should work like this:
- When a train enters a depot, it should check for a replacement for the depot rail type. If it has one, it is converted; otherwise, nothing happens.
- When a depot conversion is attempted, trains stopped inside are checked for replacements for the conversion target rail type. If all of them have one and can be converted, they are; otherwise, an error is thrown.
The first point would encompass autoreplace, the second one would be autoconvert (but the new name would be pointless now). In fact, this new scheme would actually improve
autoreplace, because you could have, for instance, two different replacements for a steam engine, a diesel one for non-electrified depots and an electric one for electrified depots, and they would be upgraded accordingly.
And, for autoconvert, I don't think we should try to second-guess the user about compatible rail types. If they attempt to convert a depot to a universal rail type, we should only look for a replacement for that precise rail type, no matter if they have set replacements for other compatible rail types. (At least for now, since this is a small change in behaviour that could be tweaked later.)
There is an old suggestion floating around to combine autoreplace and autorenew, which may be combined with this.
so the idea would be, to have the same window with (possibly) 3 buttons:
- replace immediately (active when engine A and engine B have compatible railtype, but are not the same)
- replace when old (also active when A and B are the same)
- convert (active when A and B have no compatible railtype)
As I see it, the best way to do this would be to have an additional target option "autorenew" when the user selects the same source and target rail types. In fact, it would be mostly like an ordinary autoreplace (with itself), only that with an age check.