Patch: Partial refit

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

Re: Patch: Partial refit

Post by Eddi »

One situation where this could be useful is different liveries. E.g the DBSetXL can refit closed wagons to "Goods (piece goods)" and "Goods (beer)" with different liveries but otherwise same cargo, which might create some aesthetically interesting sets, instead of monotonous boring trains.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Partial refit

Post by Terkhen »

Patch updated; the bug reported by Kogut is now fixed and the code is more clean now. You can find the updated diff and win32 binary at the first post.
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Patch: Partial refit

Post by andythenorth »

Terkhen wrote:No, because in some cases it is impossible to display all the cargos at once. For example, check the refit window for the Ishizuchi Industrial Tram (HEQS) running with FIRS
to me that just emphasises the need for rv-wagons :twisted:
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Partial refit

Post by Terkhen »

New update!

The selection code has been completely revamped: it now works correctly under RTL languages and also allows to select vehicles in any direction. The code has also been cleaned up. I still have to test if there are any problems with refittable dual headed engines. The link to the patches and an updated win32 binary can be found at the first post.

I still have the sensation that this patch might fail under some conditions (maybe with some NewGRFs). Any feedback (even mentioning under which NewGRFs it has been tested successfully) will be helpful.
maquinista
Tycoon
Tycoon
Posts: 1828
Joined: 10 Jul 2006 00:43
Location: Spain

Re: Patch: Partial refit

Post by maquinista »

Nice patch!

It's awesome if You want a train with different liveries.
Attachments
Screenshot.
Screenshot.
reffit_better.png (18.38 KiB) Viewed 2089 times
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Partial refit

Post by Terkhen »

Do you think that the refit window should stay opened after doing a partial refit? IMO it makes sense to suppose that the user is going to do more refits after that one.

Did anyone find problems while doing partial refit of articulated engines?
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: Patch: Partial refit

Post by Zephyris »

Is this trains only? Or are articulated road vehicles also supported?
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Partial refit

Post by Terkhen »

It does now, although it has not been tested much. Diffs and binary updated in the first post.

I'll have to look at some nice way of unduplicating the road vehicle/train code, but for now further testing should be nice.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Patch: Partial refit

Post by Alberth »

Just tried a simple case. Seems to be working, even nicer than I thought. NARS2 has several 'wood' wagons, and I could switch between them without loosing the loaded cargo.

- After opening the window, the bottom panel displays a refit cargo + price without having anything selected.

- Perhaps select everything instead of nothing? It makes it more clear the refit is for the whole train.

- Clicking right of the train disables selected vehicles, while clicking left of the train selects the first vehicle
- Perhaps add an explicit way to disable a selection? (clicking right of the train is typically not the first thing you'd try). It is also not mentioned in the tool tip.

- The tooltip at the refits is imcomplete. It says 'click to select a cargo' which I did after selecting a vehicle. Nothing was refit.
- You could enable the refit button only after selecting a refit.

- Closing the window after a refit is annoying. Possibly also because I didn't find the drag feature at first, so I needed to refit the same train several times.
- If you don't close the window automatically, perhaps a 'close' button might be useful??

- Being able to drag is nice, but I am not sure it is good here. I expected to drag the vehicle to another position at first. Perhaps clicking at a wagon could toggle its selection instead.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Patch: Partial refit

Post by Kogut »

There are problems with HEQS trams - I finally menaged to refit to 26 en supplies and 234k l of oil, but:
- selecting parts is a bit strange in best case (probably caused that code wise there are many invisible parts)
- rubbish on screen on moving window with longest tram
Attachments
Przechwytywanie.PNG
Przechwytywanie.PNG (32.08 KiB) Viewed 1999 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Patch: Partial refit

Post by frosch »

Terkhen wrote:Do you think that the refit window should stay opened after doing a partial refit? IMO it makes sense to suppose that the user is going to do more refits after that one.
IMO it should stay open if the user selected some vehicles.
If the user selected no vehicles to refit the whole consist it may close.
However, in that case refitting the whole consist by selecting no vehicles vs. all vehicles behaves different. I am not sure whether that is useful or confusing :p
Did anyone find problems while doing partial refit of articulated engines?
I tried with FIRS tip and Japanese Trains v2.1a. It contains an articulated refittable wagon (SHIKI 810 heavyweigt carrier).
With the patch you can refit single parts of it, which was not possible before (as you cannot drag single articulated parts to other trains).
I also remember some articulated car transporter in some set, though I cannot remember the sets name.

Some sets (e.g. the CSD set) also use articulated parts to create longer-looking wagons. Selecting articulated parts looks weird there.

As sets are likely to change the look of the wagons on refitting (though neither of the mentioned ones do), I think it should not be possible to refit individual articulated parts. They are a single vehicle and need to be refitted consistently.

In result that also means that road vehicles cannot be refitted in parts (unless with Andy's pony).
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Patch: Partial refit

Post by Kogut »

frosch wrote:In result that also means that road vehicles cannot be refitted in parts (unless with Andy's pony).
:( Even with special console command ended with Big Red Box Warning? (Maybe I will be able to merge that patch with Chill patchpack, in that case it wouldnt be needed for me).
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: Patch: Partial refit

Post by ChillCore »

I agree with previous posters ... Refit gui should stay open until closed by player.


Some (quick) testing with latest available diff (r21322):

- The qlitches metioned by Kogut do not occur when refitting trains. If wagons overflow the gui scrollbar kicks in. This does not seem to happen with road vehicles or maybe it does not overflow enough for the scrollbar to kick in. I have not yet tested changing the code so that the gui default size is smaller on opening.

- HEQS r308 -> trams.
-- Attachment 1: Capacity is one long line. maye better to insert a break? The (x tons in x wagons) showing is IMO something that should be fixed in HEQS after patch goes to trunk?
-- Attachment 2: Kreuzberg industrial tram -> first possible selection is not a vehicle. Last wagon can not be selected.
-- Attachment 3: When selecting wagons on the Henningsdorf Industrial tram to refit them selectionbox size does not correspond to the actual wagons. Also last wagon can not be selected.

Both trams are available in 1950.
Attachments
Drinfingpool Transport, 13th Oct 1950.png
Drinfingpool Transport, 13th Oct 1950.png (25.52 KiB) Viewed 1955 times
Drinfingpool Transport, 22nd Jun 1967.png
Drinfingpool Transport, 22nd Jun 1967.png (3.81 KiB) Viewed 1955 times
Drinfingpool Transport, 8th Jan 1950.png
Drinfingpool Transport, 8th Jan 1950.png (2.96 KiB) Viewed 1955 times
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Partial refit

Post by Terkhen »

Wow, a lot of feedback :)
Alberth wrote:- After opening the window, the bottom panel displays a refit cargo + price without having anything selected.

- Perhaps select everything instead of nothing? It makes it more clear the refit is for the whole train.

- Clicking right of the train disables selected vehicles, while clicking left of the train selects the first vehicle
- Perhaps add an explicit way to disable a selection? (clicking right of the train is typically not the first thing you'd try). It is also not mentioned in the tool tip.
Good point. I guess that the best solution is to have the complete train selected at first (and display it as such). Clicking on any part of the vehicle widget that is not part of the vehicle itself should disable the selection (selecting the whole train again). Since there is not always empty space at that widget, there should be another way of clearing the current selection. Any ideas for this?
Alberth wrote:- The tooltip at the refits is imcomplete. It says 'click to select a cargo' which I did after selecting a vehicle. Nothing was refit.
At the different refit options I get 'Select type of cargo for train to carry' as tooltip. I can't find any reference to clicking in the tooltips of that window.
Alberth wrote:- You could enable the refit button only after selecting a refit.
I like that idea :)
Alberth wrote:- Closing the window after a refit is annoying. Possibly also because I didn't find the drag feature at first, so I needed to refit the same train several times.
- If you don't close the window automatically, perhaps a 'close' button might be useful??
Agreed.
Alberth wrote:- Being able to drag is nice, but I am not sure it is good here. I expected to drag the vehicle to another position at first. Perhaps clicking at a wagon could toggle its selection instead.
The refit command itself is only able to refit adjacent vehicles. Therefore, the window needs a way of quickly selecting adyacent vehicles for refitting. In my opinion dragging is suited for this. Allowing to refit non adjacent parts of a vehicle would require to store all sets of adjacent vehicles and to perform the refit command for each set. I ruled it out as too complicated.
frosch wrote:I think it should not be possible to refit individual articulated parts. They are a single vehicle and need to be refitted consistently.

In result that also means that road vehicles cannot be refitted in parts (unless with Andy's pony).
Your point makes sense. This means that I will remove the shortlived option to partially refit road vehicles. I'll have to think about how to handle articulated vehicles, as they can be in different parts of a train but they need to be refitted at the same time. Maybe it should automatically draw the articulated parts of all selected vehicles as selected too, and follow the links to the different articulated parts when the command is actually performed. This is a problematic issue :?
Kogut wrote:There are problems with HEQS trams - I finally menaged to refit to 26 en supplies and 234k l of oil, but:
- selecting parts is a bit strange in best case (probably caused that code wise there are many invisible parts)
- rubbish on screen on moving window with longest tram
Thank you for the report. I don't know if this will be affected by the removal of partial refit for road vehicles. I will check the bug once that is removed.

Chillcore: Thank you for the tests. The fixes that you describe should be in this patch, but since I'm going to remove support for refitting articulated parts independently, these issues will not be present anymore. I guess that you will have to wait until someone codes wagons for road vehicles.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Patch: Partial refit

Post by Alberth »

Terkhen wrote:Good point. I guess that the best solution is to have the complete train selected at first (and display it as such). Clicking on any part of the vehicle widget that is not part of the vehicle itself should disable the selection (selecting the whole train again). Since there is not always empty space at that widget, there should be another way of clearing the current selection. Any ideas for this?
A 'select all' button left of the scrollbar (or even just 'all')?
Terkhen wrote:
Alberth wrote:- The tooltip at the refits is imcomplete. It says 'click to select a cargo' which I did after selecting a vehicle. Nothing was refit.
At the different refit options I get 'Select type of cargo for train to carry' as tooltip. I can't find any reference to clicking in the tooltips of that window.
You are quite correct, sorry for the confusion.

My point was/is that after selecting a part of the the train, I clicked at a cargo to refit to, and it just got selected, nothing more. It took a while before I realized I should also click the 'refit' button at the bottom, or double click the cargo.

You could mention the latter in the tooltip, but otherwise I guess it is a case of SUE: Stupid User Error
Terkhen wrote:
Alberth wrote:- Being able to drag is nice, but I am not sure it is good here. I expected to drag the vehicle to another position at first. Perhaps clicking at a wagon could toggle its selection instead.
The refit command itself is only able to refit adjacent vehicles. Therefore, the window needs a way of quickly selecting adyacent vehicles for refitting. In my opinion dragging is suited for this. Allowing to refit non adjacent parts of a vehicle would require to store all sets of adjacent vehicles and to perform the refit command for each set. I ruled it out as too complicated.
Sounds reasonable. I'd say keep dragging.

As for the refit command, is refitting of the vehicles in-between the selections to their current cargo a possibility? If you can do that for free, it seems like a way to keep a single refit command without much effort. (Perhaps this is a way to solve the problem mentioned by frosch?)
maquinista
Tycoon
Tycoon
Posts: 1828
Joined: 10 Jul 2006 00:43
Location: Spain

Re: Patch: Partial refit

Post by maquinista »

I have tried this patch with an articulated locomotive (Crocodile), and It fails when I select two parts or three of the locomotive.

I have used a compiled version downloaded in Friday or Thursday.
Attachments
SpainSet_1-28_Preview.zip
Preview file. Is not finished. It is not compatible with previous versions of SpainSet or future versions.
(544.76 KiB) Downloaded 45 times
Screenshot when I select two first parts. The first passenger car changes their livery.
Screenshot when I select two first parts. The first passenger car changes their livery.
fail_A.png (19.12 KiB) Viewed 1842 times
Screenshot when I select three first parts. The two first passenger cars becomes in a "two colours" livery.
Screenshot when I select three first parts. The two first passenger cars becomes in a "two colours" livery.
fail_B.png (19.13 KiB) Viewed 1842 times
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Patch: Partial refit

Post by Kogut »

So maybe it should be impossible to select part of articulated engine/wagon?
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Partial refit

Post by Terkhen »

After checking my last post it might not be obvious that I'm going to remove support for refitting different parts of the same articulated vehicle (although that's what I meant to say), as it has problems with many sets and might even break the NewGRF specs.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Partial refit

Post by Terkhen »

This time we have a long list of changes (you can get the updated patch queue and binary at the first post).
  • Long road vehicles / trams are not drawn outside of the window anymore.
  • Remove support for refitting individual articulated / dual headed parts. Instead, whenever a part of an articulated or dual headed vehicle is selected, the whole vehicle is selected too. The same stands for refitting.
    partial_refit.png
    partial_refit.png (38.29 KiB) Viewed 1694 times
  • As a result of the previous point, road vehicle support has been removed.
  • Show the complete train as selected when there is no selection.
  • Clicking at the empty space at the left of the vehicle now clears the selection correctly.
  • Enable the refit button only after selecting a cargo to refit.
  • Don't close the refit window after a refit, unless the selection was cleared.
I have not implemented the "Select All" button, where do you think it should be placed?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: Partial refit

Post by planetmaker »

Terkhen wrote: I have not implemented the "Select All" button, where do you think it should be placed?
What about double click on the vehicle working as 'select all'? It works in many applications in order to select the whole word / line /...
I'd place the button left of the 'refit' button. Possibly smaller than that 1/3 for 'select all' to 2/3 for 'refit' of the window width.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 42 guests