Patch: Filter by cargo [in trunk]

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

Tiberius
Engineer
Engineer
Posts: 86
Joined: 17 Sep 2004 03:15

Re: Patch: Filter by cargo [r13085]

Post by Tiberius »

Thanks planetmaker :)

For those who wonder why this haven't went into trunk yet: OpenTTD official developers want to share the interface used to filter stations (which can select multiple cargo types at once), preferably share the same code.

Perhaps I should implement a whole new widget type for this ? I don't even know if enlarging 'data' in Widget from uint16 to uint32 is safe/the right thing to do(tm) for now ... :wink:

I may (or may not) implement it recently (or in distant future), but don't hold your breath. If anyone want to be the one please implement it for us all, meanwhile you can BuildOTTD yourself or try my patchpack 8)
I may implement/fix/tweak/eat/ditch it soon (or in distant future, if at all, so don't hold your breath).
If anyone want to be the one please implement it for us all 8)
Tiberius
Engineer
Engineer
Posts: 86
Joined: 17 Sep 2004 03:15

Re: Patch: Filter by cargo [r13085]

Post by Tiberius »

The second filter-by-cargo patch that uses station cargo filtering interface ... 8)
Not sharing the same code though, didn't come up a good way to do it ...

When opening a new vehicle-purchasing window it'll restore the last filter used with the same type of vehicles (road, train, ship, airplane).

Use CTRL to select multiple cargo types at once.
I was trying to link a Factory in the following picture, for example ...

NO = Show vehicles that takes no cargo at all (that is, locomotives)
Attachments
filter-by-cargo.png
filter-by-cargo.png (16.93 KiB) Viewed 4630 times
filter-by-cargo_v2_r13733.patch
(16.89 KiB) Downloaded 109 times
I may implement/fix/tweak/eat/ditch it soon (or in distant future, if at all, so don't hold your breath).
If anyone want to be the one please implement it for us all 8)
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Patch: Filter by cargo [r13085]

Post by DJ Nekkid »

i have a certain feeling that your approach (accorting to the screenie) witht teh small "icons" on the top with "ps, cl, ML, OL, LV, GD ... NO, ALL" will have some pain with window size if used with one or two (or rather a few) ECS vectors, or some other "new cargo" grfs... Altho, i heavent tested this, but it's just a notch I have...
Member of the
ImageImage
Tiberius
Engineer
Engineer
Posts: 86
Joined: 17 Sep 2004 03:15

Re: Patch: Filter by cargo [r13085]

Post by Tiberius »

It will automatically enlarge the window to accommodate additional buttons for more cargo types introduced by NewGRFs (max 32 as OTTD allowed), like the screenshot below.

Since we know developers want the window as small as possible, make it easier porting OTTD to small-screen devices like NDS, PSP, S60 etc., therefore I decide to keep window sizes manageable from the beginning. Hey, perhaps someone will ask me to show these buttons in multiple rows later :roll:
Attachments
filter-by-cargo-ECS.png
filter-by-cargo-ECS.png (10.62 KiB) Viewed 4598 times
I may implement/fix/tweak/eat/ditch it soon (or in distant future, if at all, so don't hold your breath).
If anyone want to be the one please implement it for us all 8)
sir_schwick
Engineer
Engineer
Posts: 22
Joined: 26 Jul 2008 03:09

Re: Patch: Filter by cargo [r13085]

Post by sir_schwick »

I recently tried out this patch, as it was bundled with Roest's Patchpack. On the prescribed build(r1309 I think) most of the other patches work but this one is not present at all. I am also running ECS and its compatible grfs at the moment. Is Filter by Cargo compatible with ECS?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: Filter by cargo [r13085]

Post by planetmaker »

sir_schwick wrote:Is Filter by Cargo compatible with ECS?
Look at the image caption in the posting imediately above your post.
User avatar
Timitry
Transport Coordinator
Transport Coordinator
Posts: 313
Joined: 01 Oct 2004 15:28
Contact:

Re: Patch: Filter by cargo [r13085]

Post by Timitry »

Heyho!

I like that patch, looks really good!

2 things: First, the multiple rows-thing for the icons would be good, as the window shouldn't be too wide.
Second: Maybe this is already implemented, did not test it, but does it show a tooltip when right-klicking on or hovering over the cargo icons, telling you which cargo it is? As especially with ECSVectors it can be hard with the abbrevations...

Hope to see this in trunk soon!
sir_schwick
Engineer
Engineer
Posts: 22
Joined: 26 Jul 2008 03:09

Re: Patch: Filter by cargo [r13085]

Post by sir_schwick »

planetmaker wrote:
sir_schwick wrote:Is Filter by Cargo compatible with ECS?
Look at the image caption in the posting imediately above your post.
Doh. Ummm, what else should I look for to solve the issue of not having your awesome patch working?
gule
Engineer
Engineer
Posts: 60
Joined: 16 Dec 2004 15:08
Location: Slovenia

Re: Patch: Filter by cargo [r13085]

Post by gule »

After a long long time I updated this patch to trunk. It is my version with dropdown.

Updated version in first post.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Patch: Filter by cargo [r13085]

Post by Zuu »

gule wrote:After a long long time I updated this patch to trunk. It is my version with dropdown.

Updated version in first post.
Congratulations for successful merge with trunk! :)

I see your first post is from April.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: Filter by cargo [r14564]

Post by planetmaker »

small update
Attachments
filter_by_cargo_r15263.diff
update for r15263
(11.43 KiB) Downloaded 112 times
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Filter by cargo [r14564]

Post by 2007Alain2007 »

Hi i am under takeing a new patchs pack and would like to inclued your patch but i need help doing this
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
ColdIce
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 25 Apr 2006 10:22
Location: Bucharest

Re: Patch: Filter by cargo [r14564]

Post by ColdIce »

the update is here

http://bugs.openttd.org/task/1941?strin ... &closedto=

the patch is down the list for r15591
The rest is confetti!
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Filter by cargo [r15776]

Post by planetmaker »

Update for r15776
Attachments
filter_by_cargo_r15776.diff
(11.37 KiB) Downloaded 100 times
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Patch: Filter by cargo [r14564]

Post by frosch »

Despite of the general list filtering stuff someone mentioned in the FS task:

1) What's the point of cargo_filter_xxx for every vehicle type, when only one is used?
(They were static in another version of the patch FS#2196, but now?)

2) cargo_type and capacity of xxxVehInfo as well as refit_mask should no longer be used in GUI code (also not in other code, except in authorized places :p ). Use Engine::CanCarryCargo(), Engine::GetDefaultCargoType(), Engine::GetDisplayDefaultCapacity(), GetUnionOfArticulatedRefitMasks() or GetIntersectionOfArticulatedRefitMasks(). (The last part was already fixed somewhen in FS#1941)

3) + this->cargos_dropdown_pos[CF_SHOW_ALL] = 0;
Uhm, CF_SHOW_ALL is -1.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Filter by cargo [r14564]

Post by 2007Alain2007 »

trying my best to update just asking what WIDGET thing at the end do i use

{ WWT_DROPDOWN, RESIZE_RIGHT, COLOUR_GREY, 191, 293, 14, 25, 0x0, STR_SORT_CRITERIA_TIP},

think its this // BUILD_VEHICLE_WIDGET_SORT_DROPDOWN but every time i try i get an errour in game :(
For Community Integrated Version http://code.google.com/p/civopenttd/
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Filter by cargo [r14564]

Post by 2007Alain2007 »

I tryed my best to get this updated and have failed :( can any one help please by updateing it
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: Filter by cargo [r14564]

Post by planetmaker »

look at flyspray for a re-written version. I haven't tested it yet, though.
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Filter by cargo [r14564]

Post by 2007Alain2007 »

no there updated the widgets in the build_vehicle_gui
For Community Integrated Version http://code.google.com/p/civopenttd/
gule
Engineer
Engineer
Posts: 60
Joined: 16 Dec 2004 15:08
Location: Slovenia

Re: Patch: Filter by cargo [in trunk]

Post by gule »

In trunk (r16042) thanks to frosch and srb.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 17 guests