[Patch] Group by Property

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

Post Reply
sulai
Traffic Manager
Traffic Manager
Posts: 159
Joined: 24 Sep 2004 18:23

[Patch] Group by Property

Post by sulai » 20 Sep 2009 23:50

This patch adds a drop down to the "create new group" button in the vehicle window. See the screenshot below. Using one of the entries allows you to create Vehicle Groups based on common properties of vehicles.

If you have some group selected, only vehicles out of this group are considered. For example, you may select "all trains", choose "Group old Vehicles". Select the new group and choose "Group vehicles with negative income" - you will get a group with vehicles that are both old and have negative income.

Works for all vehicle types, of course.

Old behavior is untouched: if you just click the "new group" graphical button, you will notice no changes.

It's a simple yet powerful patch. Have fun :)
Attachments
group_by_property.png
group_by_property.png (58.44 KiB) Viewed 2097 times
group_by_property_r17594.diff
(9.42 KiB) Downloaded 121 times
Last edited by sulai on 21 Sep 2009 10:42, edited 2 times in total.

2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06

Re: [Patch] Group by Property

Post by 2007Alain2007 » 21 Sep 2009 00:20

sounds fun and help full theres work on the last years porfit
For Community Integrated Version http://code.google.com/p/civopenttd/

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Patch] Group by Property

Post by Roujin » 21 Sep 2009 06:46

Does it create a virtual, temporary group, or does it take the vehicles fitting the criteria out of their current group (if any) and put them into a new full-fledged group?
I can see much potential in the former idea, with an option to transform it to a full-fledged group.

Sorry for requesting stuff without even having tested your patch first, but I'm not in a position to test it right now and the thought just popped to my head.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage

User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: [Patch] Group by Property

Post by Gremnon » 21 Sep 2009 08:20

I like the idea of this patch.

I have one small issue, namely one warning generated on compiling with it:

Code: Select all

~/svn/ottd-testing/src/group_gui.cpp: In function ‘void CcCreateGroup(bool, TileIndex, uint32, uint32)’:
~/svn/ottd-testing/src/group_gui.cpp:775: warning: comparison between signed and unsigned integer expressions

sulai
Traffic Manager
Traffic Manager
Posts: 159
Joined: 24 Sep 2004 18:23

Re: [Patch] Group by Property

Post by sulai » 21 Sep 2009 10:44

Roujin wrote:Does it create a virtual, temporary group, or does it take the vehicles fitting the criteria out of their current group (if any) and put them into a new full-fledged group?
It does take the vehicles fitting the criteria out of their current group (if any) and put them into a new full-fledged group. Note: only the current selected group is considered. So if you select "ungrouped vehicles", it won't touch any custom group.
Gremnon wrote:warning generated on compiling with it
Thanks Gremnon! I don't get this warning and I see two possible reasons for that warning in that code line. I removed one of them (and making the code a little prettier in the same step). Could you test it again? Update see first post.

User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: [Patch] Group by Property

Post by Gremnon » 21 Sep 2009 11:40

That's fixed it, no warning this time. Thanks sulai

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 3 guests