Page 2 of 4
Re: Patch: Small map industry selector
Posted: 22 Oct 2007 13:18
by gule
belugas wrote:As for the rest, bravo
Thank you.
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?
Re: Patch: Small map industry selector [done]
Posted: 22 Oct 2007 23:25
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.
Re: Patch: Small map industry selector [done]
Posted: 23 Oct 2007 10:43
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.
Re: Patch: Small map industry selector [done]
Posted: 23 Oct 2007 13:05
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...
Re: Patch: Small map industry selector [done]
Posted: 23 Oct 2007 21:33
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.
Re: Patch: Small map industry selector [done]
Posted: 24 Oct 2007 12:39
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.
Re: Patch: Small map industry selector [done]
Posted: 24 Oct 2007 23:22
by athanasios
Thanks a lot gule!

Wonderfull!
My opinion is make it an option.
Re: Patch: Small map industry selector [done]
Posted: 24 Oct 2007 23:35
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!
Re: Patch: Small map industry selector [done]
Posted: 25 Oct 2007 09:42
by richk67
I agree. I dont see any need to make it optional. It is currently obvious and unobtrusive.
Re: Patch: Small map industry selector [done]
Posted: 25 Oct 2007 10:30
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.
Re: Patch: Small map industry selector [done]
Posted: 25 Oct 2007 10:53
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.
Re: Patch: Small map industry selector [done]
Posted: 25 Oct 2007 11:16
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.
Re: Patch: Small map industry selector [done]
Posted: 25 Oct 2007 12:44
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.
Re: Patch: Small map industry selector [done]
Posted: 25 Oct 2007 18:39
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.

Re: Patch: Small map industry selector [done]
Posted: 26 Oct 2007 11:39
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.
Re: Patch: Small map industry selector [done]
Posted: 26 Oct 2007 11:56
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.
Re: Patch: Small map industry selector [done]
Posted: 26 Oct 2007 13:45
by Roujin
Another bug report from me
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)
Re: Patch: Small map industry selector [done]
Posted: 26 Oct 2007 14:34
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

Re: Patch: Small map industry selector [done]
Posted: 29 Oct 2007 12:39
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

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.
Re: Patch: Small map industry selector [done]
Posted: 07 Nov 2007 15:57
by gule
In first post is updated version to trunk (11388).