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

Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Patch: Partial refit

Post by Terkhen »

This patch allows to select a part of a train or road vehicle at the refit window and to refit only that part.
Trarnton Transport, 2050-04-03.png
Trarnton Transport, 2050-04-03.png (28.73 KiB) Viewed 7666 times
The source code can be found at http://devs.openttd.org/~terkhen/patches/partial_refit/. The patch is in need of testing; any feedback will be appreciated.
Last edited by Terkhen on 14 Dec 2010 14:49, edited 10 times in total.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Patch: Partial refit

Post by MagicBuzz »

wow, nice patch :)
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Patch: Partial refit

Post by Kogut »

Is it possible to allow selecting wagons using ctrl+clicks/click with shift + click methods?
Is it possilble to resize window when there are many cargos possible?
Attachments
Przechwytywanie.PNG
Przechwytywanie.PNG (21.4 KiB) Viewed 7633 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Patch: Partial refit

Post by Kogut »

Tiny bug: create train with refittable wagon and empty engine, select an engine - there are listed cargos and refit is refitting whole train.
Attachments
Przechwytywanie.PNG
Przechwytywanie.PNG (81.05 KiB) Viewed 1223 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Patch: Partial refit

Post by Eddi »

if you have a train with, say, one half open wagons and other half closed wagons, and you select e.g. grain as refit cargo, does it automatically unselect all closed wagons, which cannot be refit to grain?
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Patch: Partial refit

Post by MagicBuzz »

IMO, in this case, the patch should disable any cargo than is incompatible with any selected wagon.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Partial refit

Post by Terkhen »

Kogut wrote:Is it possible to allow selecting wagons using ctrl+clicks/click with shift + click methods?
The Ctrl+click behaviour used in depots could be implemented. I don't know what Shift + click does, though (and I can't found any info about it at the tooltips either). This reminds me that I did not add any tooltips for the new widgets and behaviour.
Is it possilble to resize window when there are many cargos possible?
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:
Suninghall Transport, 2050-01-16.png
(96.04 KiB) Downloaded 1 time
Kogut wrote:Tiny bug: create train with refittable wagon and empty engine, select an engine - there are listed cargos and refit is refitting whole train.
It is probably selecting the whole chain but not displaying the selection. Thank you for the report, I'll check it soon.
Eddi wrote:if you have a train with, say, one half open wagons and other half closed wagons, and you select e.g. grain as refit cargo, does it automatically unselect all closed wagons, which cannot be refit to grain?
In this case, the behaviour is unchanged from vanilla OpenTTD. You can select all options available to the current selection, and if you refit to a cargo option that is not available for all wagons of the selection, only the wagons that are able to refit to that cargo will be refitted. I agree that this is confusing, and because of that I would like to have a well defined behaviour to deal with this issue before implementing it. Have in mind that the creation of refit orders still uses the old method (and it is not the goal of this patch to implement partial refit orders), and both methods should stay as consistent as possible.
User avatar
ColdIce
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 25 Apr 2006 10:22
Location: Bucharest

Re: Patch: Partial refit

Post by ColdIce »

OMG! :shock:
great great great patch.. very very usefull. thank you :bow:
The rest is confetti!
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Patch: Partial refit

Post by Alberth »

Could you please explain for the less advanced players like me, why do you need this capability?
I never have a need for a train with more than one cargo (except passengers/mail but those come conveniently as two different wagons).
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 »

Take a train set with wagons which have many refit options. Then you might take one wagon type and want to send it e.g. to the FIRS refinery. This example might not fit industries as found 100%, but just for the illustation: There you want half the wagons to pickup fuel oil and the other half to pickup goods (instead of the default milk).

Or a very good excample are the MU wagons of the 2cctrainset: PAX, mail and valuables. You want a mixed train. Currently not easy to assemble that train (not too difficult either, though)
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Partial refit

Post by Terkhen »

It's only useful for mixed trains. Personally I don't use them much either (except for farms with very small production). It is already possible to do partial refits without the patch, but you need to move the wagons you don't want to refit outside the train, refit the rest, and join them back again. The patch aims to provide a GUI for doing an otherwise tedious task.
blitzkrieg
Engineer
Engineer
Posts: 105
Joined: 30 Jun 2006 04:22

Re: Patch: Partial refit

Post by blitzkrieg »

Great patch!! :D
Hope it makes to trunk.
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: Patch: Partial refit

Post by cmoiromain »

Terkhen explains it exactly how I see it. This gives you control over individual wagons, whereas OpenTTD currently only allows to globally control the whole train, which is annoying in some cases.
I am little, ugly, and nasty. How do you do?
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Patch: Partial refit

Post by michael blunck »

cmoiromain wrote: This gives you control over individual wagons, whereas OpenTTD currently only allows to globally control the whole train, which is annoying in some cases.
In principal, there´s a comparable number of mouse actions needed as before (i.e., detaching wagons). And I could easily construct cases where the current method needs less actions.

Other than that, an interesting approach, but in need of further discussion.

regards
Michael
Image
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Patch: Partial refit

Post by Kogut »

michael blunck wrote:. And I could easily construct cases where the current method needs less actions.
For example...
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 have not yet tested but I have been in a few situations where I wished something like this existed. eg. Delivering food and goods to towns by means of one train, combining iron ore and coal for steel mills, picking up/delivering supplies in FIRS, etc, etc, etc.
The way trunk is now you need an extra loc for refitting wagons or move a lot of wagons back in and out of the consist as wagons can not be refitted when not attached to an engine.

Very nice idea Terkhen.
Hope it makes trunk someday soon. :)

/ChillCore wonders if this can be extended to refitting specific wagons in the depot by means of the order list. :twisted:
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

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 »

ChillCore wrote:Very nice idea Terkhen.
Hope it makes trunk someday soon. :)
It needs testing before I consider that :)
ChillCore wrote:/ChillCore wonders if this can be extended to refitting specific wagons in the depot by means of the order list. :twisted:
There are many problems of concept with that idea. For example, two trains that have a completely different combination of wagons can share orders. What should the partial refit order do then?. Other issues were discussed on IRC a few weeks ago, but I don't remember the most complicated one right now.

Besides that, there are also many implementation issues (IIRC there was not enough free space in one of the order data structures). This is why I said that partial refit orders are outside of the scope of this patch.
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: Patch: Partial refit

Post by ChillCore »

Terkhen wrote:
ChillCore wrote: Very nice idea Terkhen.
Hope it makes trunk someday soon. :)
It needs testing before I consider that :)
Going to download the patch right now and have a looksie at the code.
And test ofcourse. ;)
Terkhen wrote:
ChillCore wrote: /ChillCore wonders if this can be extended to refitting specific wagons in the depot by means of the order list. :twisted:
There are many problems of concept with that idea. For example, two trains that have a completely different combination of wagons can share orders. What should the partial refit order do then?. Other issues were discussed on IRC a few weeks ago, but I don't remember the most complicated one right now.
Hmm ... yes I did not think of that.
Linkie to the IRC-log would be apreciated, if someone remembers when the conversation took place that is. :)
Terkhen wrote: Besides that, there are also many implementation issues (IIRC there was not enough free space in one of the order data structures). This is why I said that partial refit orders are outside of the scope of this patch.
I have re-read the topic and I had missed that line before ... sorry.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

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 »

Don't bother much with the code for now; I still have to clean up many inconsistencies. I also have to figure out if the vehicle image should be displayed for all vehicle types, as it does not serve an actual purpose for them.

The discussion started at this time, but I don't know when the issues were discussed.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 10 guests