Patch: Small map industry selector v6 [update]

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

gule
Engineer
Engineer
Posts: 60
Joined: 16 Dec 2004 15:08
Location: Slovenia

Re: Patch: Small map industry selector

Post by gule »

belugas wrote:As for the rest, bravo
Thank you. :D

I change disabled industry type color to more readable one and keep red boxes. (first post)

I think that this patch is finished.

Is anybody using it?
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Patch: Small map industry selector [done]

Post by athanasios »

:]

I have a suggestion, and I believe this is the right place and time to post it.

Would it be practical to count how many industries of each kind exist on map and display that number here, next to the industry's name? I believe it will be of value when playing on a huge map.

Code: Select all

COAL MINE (12)
POWER STATION (5)
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
gule
Engineer
Engineer
Posts: 60
Joined: 16 Dec 2004 15:08
Location: Slovenia

Re: Patch: Small map industry selector [done]

Post by gule »

Nice idea athanasios, i will look in code if it is possible. I think there should already be a list with industry counters or something similar.
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Patch: Small map industry selector [done]

Post by belugas »

I'm not too sure of the usefulleness of it but...
you do not to count, it's already done : industry.h:276
_industry_counts[NUM_INDUSTRYTYPES] holds the current count of industry per type.

I just don't know, once more, how usefull it really is...
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Patch: Small map industry selector [done]

Post by athanasios »

Well, if many industry grfs are loaded, and you want to plan an effective network you need to know how many industries of a specific type exist on the map. Instead of sorting and searching on a long Industry Directory this could give you a quick answer. Personally I wouldn't start a network when only 1 or 2 raw industries of a certain type exist on the map. This can easily be the case with ESC set.
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
gule
Engineer
Engineer
Posts: 60
Joined: 16 Dec 2004 15:08
Location: Slovenia

Re: Patch: Small map industry selector [done]

Post by gule »

Here is patch also with industry counts after industry name. Maybe I should do it as patch option?
I do not know if is small map the right place for this information. :?
If somebody find this usefull, use it.

belugas: thank you to point me in the right direction.
Attachments
Unnamed, 1st Jan 1950.png
Unnamed, 1st Jan 1950.png (43.26 KiB) Viewed 2726 times
smallmap_industry_selector_r11339.diff
(9.11 KiB) Downloaded 98 times
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Patch: Small map industry selector [done]

Post by athanasios »

Thanks a lot gule! :D :D :D Wonderfull!

My opinion is make it an option.
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Patch: Small map industry selector [done]

Post by belugas »

You may think i'm a downer, but i see very little reason to make it an option. Maybe a setting in the window itself, but please... do not make everything a patch option!
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Re: Patch: Small map industry selector [done]

Post by richk67 »

I agree. I dont see any need to make it optional. It is currently obvious and unobtrusive.
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
gule
Engineer
Engineer
Posts: 60
Joined: 16 Dec 2004 15:08
Location: Slovenia

Re: Patch: Small map industry selector [done]

Post by gule »

2 to 1 :)
I leave it as it is then. Maybe I will add a "Show number of industries" button or something similar.
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Patch: Small map industry selector [done]

Post by Bilbo »

Also, maybe it would look better, if the numbers of industries would be in some other color, like blue of gray, to be a bit distinctive from the industry names.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Small map industry selector [done]

Post by Roujin »

I propose instead to put the number front of the name, to make them aligned. I'll have a look at it now first though.

And i agree with belugas as well, a patch option should only be made if it changes behavior significantally, so people who don't like it can deactivate it.

edit: I tested it now, and i found it reacts a bit slow, and tends to draw stuff partially when switching visibility of something (except enable/disable all, that works like a charm)
I think you should change it in a way that it changes it all simultaniously and then redraws the window, so it won't be drawn partially.
* @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
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: Patch: Small map industry selector [done]

Post by XeryusTC »

There is a small bug in your patch. When you click under one of the columns of industry names an industry in the next column will be enabled/disabled. It kind of depends on how far below the lowest one you click for which one will turn on/off too.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
gule
Engineer
Engineer
Posts: 60
Joined: 16 Dec 2004 15:08
Location: Slovenia

Re: Patch: Small map industry selector [done]

Post by gule »

Roujin wrote:I tested it now, and i found it reacts a bit slow, and tends to draw stuff partially when switching visibility of something (except enable/disable all, that works like a charm)
I think you should change it in a way that it changes it all simultaniously and then redraws the window, so it won't be drawn partially.
I'll try to make it faster and remove some of for loops.
XeryusTC wrote:There is a small bug in your patch. When you click under one of the columns of industry names an industry in the next column will be enabled/disabled. It kind of depends on how far below the lowest one you click for which one will turn on/off too.
Thank you for this. My first ottd bug report. :)
gule
Engineer
Engineer
Posts: 60
Joined: 16 Dec 2004 15:08
Location: Slovenia

Re: Patch: Small map industry selector [done]

Post by gule »

I fixed both problems.
Now redraws window faster and you if you click below industries list, you do not select industry in next column.
Diff file is in first post.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Small map industry selector [done]

Post by Roujin »

Wonderful! :)

Just one more thing i noticed, it keeps the settings even if you go back to main menu and/or start a new game or load a game. I think it should reset to "show all" when loading a game or starting a new game.

edit: i just got a bug, i just don't know if it's your patch's fault or OpenTTD's.
just recreated it again without any newGrfs.

In a game i started with very low industries, it says Farm(0), but there is one farm in the game. Instead, it says Bank(1) but there is no bank.

Savegame attached.
Attachments
Farm Bug.sav
(78.86 KiB) Downloaded 79 times
* @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
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Small map industry selector [done]

Post by Roujin »

Another bug report from me :P

your patch currently supplies only up to 32 industry types. I popped in all ECS vectors i could find for testing, which resulted in 34 different industry types.

With your patch, the 33rd is linked with the 1st and the 34rd is linked with the second industry. (due to overflow i guess)
which means if you click on the first industry, both the first and the 33rd industry will toggle. Same with clicking on the 33rd of course. (and with 2nd + 34rd, accordingly)
* @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
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Patch: Small map industry selector [done]

Post by belugas »

/me points to this interesting but wrongfull declaration:

Code: Select all

+static uint _legend_excluded_industry;
/me thinks it would rather be

Code: Select all

+static uint64 _legend_excluded_industry;
But... there is something that bothers me about the use of a bitmask var.
Just a though : why can't you use the _legend_from_industries structure for the toggling? It would certainly make life easier...
Sorry, i know i should have though of that earlier, it just striked me right now :oops:
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
gule
Engineer
Engineer
Posts: 60
Joined: 16 Dec 2004 15:08
Location: Slovenia

Re: Patch: Small map industry selector [done]

Post by gule »

Roujin wrote:Just one more thing i noticed, it keeps the settings even if you go back to main menu and/or start a new game or load a game. I think it should reset to "show all" when loading a game or starting a new game.
Now it reset to show all at loading a game or starting new one.
belugas wrote:But... there is something that bothers me about the use of a bitmask var.
Just a though : why can't you use the _legend_from_industries structure for the toggling? It would certainly make life easier...
Sorry, i know i should have though of that earlier, it just striked me right now :oops:
I added one more value in _legend_from_industries structure - show_on_map. Now it should work for any number of industries.

New version in first post.
gule
Engineer
Engineer
Posts: 60
Joined: 16 Dec 2004 15:08
Location: Slovenia

Re: Patch: Small map industry selector [done]

Post by gule »

In first post is updated version to trunk (11388).
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Baidu [Spider] and 9 guests