The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: Ranran(retired) on January 25, 2020, 11:14:42 AM

Title: [Bug] "Copy Convoy" does not copy the livery
Post by: Ranran(retired) on January 25, 2020, 11:14:42 AM
Reproduction steps:
1) Purchase a vehicle with livery. (Please choose a color other than the default)
2) Assign Line
3) Press the Copy Convoy button to duplicate the vehicle
4) Start those vehicles from the depot

(´・ω・`)
Title: Re: [Bug] "Copy Convoy" does not copy the livery if line is selected
Post by: Ranran(retired) on February 15, 2020, 09:12:59 AM
This problem is caused by:
when set_line() (https://github.com/jamespetts/simutrans-extended/blob/c97845bbf4011adf5b6d2bda615a3f4d7c81b557/simdepot.cc#L469) is executed in copy (depot_t::copy_convoi) operation, it will be overwritten by the line's livery scheme.
That is, if line is selected, it will be rewritten to the line's livery regardless of the current convoy and the livery scheme applied to the vehicle.
The problem is that if the livery scheme is not set for the line, the "default" livery will overwrite the original one.


The problem with this - there is no way to set the livery scheme directly in convoy.
in most cases it is unset or the same as line.

Currently, there are two ways to set the livery.
a) Set individual vehicle from the depot dialog
b) Set all convoys on the line in the linemanagement dialog

"a" applies to vehicles only and does not update the convoy or line livery scheme.
"b" can rewrite all convoy and vehicle's livery scheme which belong to the line.
There is no way to directly rewrite convoy's livery. It is possible to set the livery scheme for individual convoys by setting one convoy for the line though.

Imagine a convoy consisting of one vehicle like a bus.
The player selects the desired livery scheme in the depot with the livery scheme selector when purchasing it.
The bus is set up with a unique livery, but it is only stored in the vehicle, not convoy.

If line does not have a livery scheme, convoy also does not often have a livery scheme. So it is pointless here to temporarily hold the convoy's livery scheme and keep it.
Next, the vehicle has a livery but no information on the livery scheme.

I think If the livery scheme of line or convoy is undefined, it is necessary not to overwrite the livery by default.

EDIT:
There is no blank choice in the livery scheme selector. Therefore, the livery scheme that the player does not intend may be set to line.
Note that if an unrelated livery scheme is set, it will also override by default.
Title: PR#584 - "Copy convoy" copies vehicle's livery
Post by: Ranran(retired) on November 04, 2022, 01:56:30 PM
In the course of our pakset development work, it was pointed out that this bug was very problematic when playing bus companies as the main subject, and it discouraged bus otakus. So I decided to try to solve this problem again.
I think the cause of this problem is caused by a mismatch between the system and the UI.

By default, line and convoy have livery index=0, so overriding this will prevent copying the vehicle livery.

On the other hand, depot dialog cannot specify line or convoy liveries. You can only select a livery when purchasing a vehicle, and only vehicles have a livery data. Most players don't do anything other than select a livery in the depot dialog, so I think only a few CONVOYs have livery data. (So what I'm saying is that most single vehicle convoys like buses don't have a livery scheme set to the convoy or line, even if the vehicle has its own livery set.)
These situations create situations where the livery is not copied when copying the convoy, which confuses the player.


The patch fixes the copy convoy in the depot to copy the vehicle's livery.
Note that it may not be possible to copy its livery. If the livery is obsolete, it cannot be copied.
However, most of the time the copy will be used to copy a new vehicle, so the copy will work exactly as the player intended.
Title: Re: [Bug] "Copy Convoy" does not copy the livery if line is selected
Post by: jamespetts on November 04, 2022, 09:44:01 PM
Thank you for this. Can I check whether this has been tested for compatibility with the ex-15 branch?
Title: Re: [Bug] "Copy Convoy" does not copy the livery
Post by: Ranran(retired) on November 04, 2022, 11:59:56 PM
Quote from: jamespetts on November 04, 2022, 09:44:01 PMThank you for this. Can I check whether this has been tested for compatibility with the ex-15 branch?
No. As reported before, ex-15 branch has broken the livery scheme feature since at least 2018, so it was not possible to test this.


The changes I made were that the copy convoy tool is
1) The latest available livery scheme uniquely set by the original vehicle
2) livery scheme set to convoy/livery
Livery is now selected in this order.


I don't expect this change to affect code related to overhaul livery functionality at depot visits at this time.
I also don't think this change will have any further negative impact on the currently broken livery scheme feature in the ex15 branch. That code was not changed, which means that if relevant, a similar change had to be made there.
Title: Re: [Bug] "Copy Convoy" does not copy the livery
Post by: jamespetts on November 05, 2022, 11:56:37 AM
Thank you for confirming. I have now incorporated this.
Title: Re: [Bug] "Copy Convoy" does not copy the livery
Post by: Ranran(retired) on November 05, 2022, 03:00:56 PM
Supplementary information:
I have tested this by merging it into the ex-15 branch.
In the ex-15 branch saving the game causes livery scheme data corruption. This caused the test to run incorrectly last time with an old save.
I tested this right after the first load and it seems to work fine.