The International Simutrans Forum

Simutrans Extended => Simutrans Extended Development => Topic started by: Vladki on September 12, 2017, 08:16:37 PM

Title: Show available liveries
Post by: Vladki on September 12, 2017, 08:16:37 PM
It would be nice if one could see which liveries are available for which car - e.g. in depot window, somewhere along other vehicle specifications (speed, capacity, intro,...)
Title: Re: Show available liveries
Post by: Rollmaterial on September 13, 2017, 05:16:06 PM
This would be very welcome as there is no way to know which scheme the default livery belongs to other that by changing from another livery in the line manager.
Title: Re: Show available liveries
Post by: Ves on September 13, 2017, 08:32:20 PM
I agree that it would be nice to see what liveries a vehicle actually has.

I do, however, have a problem, and this is the same for the list of vehicles that a selected vehicle can upgrade into from the depot:
There is a bit limited space in the window, and a big chunk of the information is very unpredictable in size already (look at some of the ships, they have three accommodations AND a bunch of restrictions!) which presents a challenge since the window has to be predefined in size (I have not managed to make a workaround for that, since the window consist of two different classes).
So, either the window is oversized in case there is even more information, or the window is the size it has currently, with the risc of information sticking out in the bottom.

One way, which makes it very predictable to show these two pieces of information, is to show only a line that says something like: "number_of_liveries_available:" and "number_of_upgrades_available:", but this feels like quite a rough, and semi useless, information.
One combination could be, like I have done it in the convoy_detail window, that it lists the first 3 upgrades, and if there are any more, it says "+ X additional upgrades"
But here the unpredictability starts to come into play again, the more entries you decide to show beofre the summary.

Do you have any suggestions?
Title: Re: Show available liveries
Post by: Ves on September 14, 2017, 11:51:28 PM
I have enlarged the window with a few lines, and I think I will go with the solution that the convoy-detail window does: show the first 2 or 3 liveries and then a summary if there are any more. The same with the upgrades.
I do however have some struggle with showing the liveries. I am using the code like this:

Code: [Select]
vector_tpl<livery_scheme_t*>* schemes = welt->get_settings().get_livery_schemes();
ITERATE_PTR(schemes, i)
livery_scheme_t* scheme = schemes->get_element(i);
if (scheme->is_available(welt->get_timeline_year_month()))
if (veh_type->check_livery(scheme->get_name()))
n += sprintf(buf + n, "%s\n", scheme->get_name());
But when running I dont get the results I want. I comment out the "if (scheme->is_available(welt->get_timeline_year_month()))" to make it show all liveries, but that appears not to help.
Strange thing is that it works on some vehicles in pak.britain but not on any of the vehicles I could try out in pak.sweden. Am I missing something there?
Title: Re: Show available liveries
Post by: jamespetts on September 16, 2017, 05:43:43 PM
Thank you for your feedback and suggestions. I was planning to look into updating the code relating to liveries at the same time as implementing maintenance features which are necessary for balance, although the time that I will have to make significant changes to the UI for liveries will be limited, so any assistance in improving this will be welcome.

Ves - is the code with which you are having trouble in any of your branches? If so, can you let me know which specific vehicles do and do not work in Pak128.Britain-Ex so that I can try to analyse the differences between those that do and those that do not work with a view to diagnosing the problem?
Title: Re: Show available liveries
Post by: Ves on September 19, 2017, 05:19:52 PM
The code I posted should be online now on this branch: (
You will have to un-comment the pieces of code, which are around line 2052 in

The difference was between pak.britain and pak.sweden. I dont know internally in pak.britain which vehicles have any liveries. I know I have made a bunch of liveries for quite some cars in pak.sweden, but there appeared not to be any. I will do some further tests to see if I can narrow anything down.

One thing to consider: It somehow feels silly that some vehicles have a livery by name, but other, similar looking vehicles, have no livery at all, thus showing no name. How should "livery-less" vehicles be threated?