Page 1 of 3

[Patch] Town colors in the town list

Posted: 23 Nov 2010 10:47
by MagicBuzz
Here is a small patch that will introduce some colors in your town list screen :

Rating poor and city status
Rating poor and no city status
Rating neutral and city status
Rating neutral and no city status
Rating good and city status
Rating good and no city status

So now you can easily find town where your rating is bad/good/neutral, and see which town is a town and which one is a simple village.

I hope you'll find this patch usefull :)

Note for devs : Isn't strange that the "RATING_GOOD" constant is 400, "RATING_MEDIOCRE" is 200, while "RATING_INITIAL" is 500.
IMHO it should be much more logical that RATING_INITIAL (not GOOD nor not MEDIOCRE) should be between 200 and 400, let's say 300.
So this patch won't use magical value, so color is based on >= or < RATING_GOOD, but I think the real milestone should be 300 instead of 400.

Re: [Patch] Town colors in the town list

Posted: 23 Nov 2010 21:35
by MagicBuzz
I just realized that the green colors were interverted. Dark green was for cities and light green was for villages.

It's now fixed, and first post updated with lastest version.

Re: [Patch] Town colors in the town list

Posted: 23 Nov 2010 21:40
by Lord Aro
hmm, nice patch! (again :roll: )
can i suggest instead of having 2 colours for city and non-city, you just have "(City)" after the name (before the population)?

Re: [Patch] Town colors in the town list

Posted: 23 Nov 2010 23:11
by MagicBuzz
There is already a patch on FS that do this. (FS#4186)

IMO, adding "city" at the label is less readable than a color : what about cities with a name like "mexico city" ? Adding or not the word "(city)" should confuse the player.

Re: [Patch] Town colors in the town list

Posted: 24 Nov 2010 07:28
by Lord Aro
Hmm, perhaps a combination of the patches?

I don't think it would confuse the user, as they would look t the list for a little longer and see that other 'towns' were cities too, and so they would (hopefully) guess what's going on though
Perhaps a tooltip could explain more about the town if it's a city, and what a city is?

Just my opinion :roll:

Re: [Patch] Town colors in the town list

Posted: 24 Nov 2010 09:57
by MagicBuzz
I'll try to find out how to display a tooltip.

But I'm not sure it's really usefull.

On Chillcore's patchpack, there is a patch that displays colors on towns names according the rating, and it was so natural that I didn't wonder any second what those colors should be for.

But before the tooltip, I'll try to find a place on the town window to display the flag "city". By this was people who didn't reallised what the color codes were for would understand in a second.

I prefer to follow the basics of ergonomy, and avoid to display more text than needed.

But you still free to merge this patch with the FS#4186.

Re: [Patch] Town colors in the town list

Posted: 24 Nov 2010 12:40
by cmoiromain
I like this patch, however I think a coloured dot in front of the name would be visually better than colouring the whole town name. I don't like multicoloured lists, I find them harder to read.

Re: [Patch] Town colors in the town list

Posted: 24 Nov 2010 13:27
by MagicBuzz
Hmm, I like this idea. However, I have absolutely not any idea about how to create and use new sprites.

I may use already existing sprites like the profit buttons or the icons used for vehicle windows to show if they are running or not... But I'm conviced using all brand new sprites should be better and would increase chances of this patch to be integrated to trunk.
=> So if anyone could show me how to do this, I'll be very gratefull ;)

Re: [Patch] Town colors in the town list

Posted: 24 Nov 2010 22:01
by Terkhen
I suggest that you check the discussion at the Rating in town label thread. We discussed a lot of different options, and you will also find why a solution for town rating using colours was not prefered in the end.

Re: [Patch] Town colors in the town list

Posted: 25 Nov 2010 18:51
by MagicBuzz
I agree with the symbol solution:
1/ You can choose the colors of the symbol easily (just update a GRF file)
2/ You can choose the symbol used (same way)
3/ Will make the list cleaner
4/ I would be able to separate information "city status" and "rating"

I will work on this solution as soon as I am able to:
1/ Draw a simple GRF file (with only a few sprites, and nothing else in it)
2/ Read the GRF file to display the symbols in the list

I could use the current profit buttons (from wehicle window) until I know a way for a better solution, but the result would be ugly and confusing.

Re: [Patch] Town colors in the town list

Posted: 26 Nov 2010 10:57
by MagicBuzz
I'm not sure but I think I found a way to display a custom GRF sprites.

But I really can't draw a GRF file : I don't have the right softs nor patience to understand how it works.

Could someone post 2 GRF files :

town_rating_symbs.grf : 3 sprites (10x10) with simple smileys like :) (green), :| (yellow) and :( (orange) ?
city_symbs.grf : 2 Sprites (10x10) with 1 small house and 1 building ?

By this way, I could display 2 columns just before the town names, 1 for the rating, and 1 for the city status.
Those symbs should be completed and reused in the "rating in town label" topic.

Re: [Patch] Town colors in the town list

Posted: 26 Nov 2010 11:22
by planetmaker
MagicBuzz wrote:I'm not sure but I think I found a way to display a custom GRF sprites.

But I really can't draw a GRF file : I don't have the right softs nor patience to understand how it works.

Could someone post 2 GRF files :

town_rating_symbs.grf : 3 sprites (10x10) with simple smileys like :) (green), :| (yellow) and :( (orange) ?
city_symbs.grf : 2 Sprites (10x10) with 1 small house and 1 building ?

By this way, I could display 2 columns just before the town names, 1 for the rating, and 1 for the city status.
Those symbs should be completed and reused in the "rating in town label" topic.
Well. A missing grf should not stop you. You'll need to add a few new GUI sprites in the appropriate action5 block of base grfs. As long as those graphics don't yet exist, you could just re-use any existing sprites :-). I'm sure if the patch which would make use of them exists, there'll surface a good implementation.

Re: [Patch] Town colors in the town list

Posted: 26 Nov 2010 11:33
by MagicBuzz
Here is my working copy patch.

It tries to load inexisting GRF, and should display them correctly if they exists.

I also tried to load a fake GRF, but using instead the vehicle profit button to test the display layout. It produces this result.
For me, it should be OK with correct sprites.

PS : When you speak about "action 5" it's really chinese for me :( I can't find a "easy to follow" tutorial to create/modify a simple sprite GRF file :/)

Re: [Patch] Town colors in the town list

Posted: 26 Nov 2010 11:47
by planetmaker
I made a quick hack into OpenGFX with 5 new GUI sprites for your use. Find it attached, a blunt copy & paste of the smilies of this forum and two existing sprites. They're sprite numbers 161 - 165 in the extra-gui block.

Re: [Patch] Town colors in the town list

Posted: 26 Nov 2010 12:40
by MagicBuzz
Thank you :)

This works like a charm except the symbols are to large.

I may change the town list item size to fit the symbols, but I think the symbols should be smaller (10x10), so I don't have to change the list items size.

Here is the patch file with the symbols loaded from the updated OpenGFX :)

=> What will the program do if OpenGFX isn't installed ? How could I check this ?

Re: [Patch] Town colors in the town list

Posted: 26 Nov 2010 13:02
by planetmaker
MagicBuzz wrote:=> What will the program do if OpenGFX isn't installed ? How could I check this ?
OpenTTD will complain about an out-dated base set with missing sprites and show the land info sprite instead of the missing ones. Just test with an official version of OpenGFX or the TTD base sprites.

As the 'extra grf' for the TTD base set is part of OpenTTD trunk this would need adding the respective sprites there in a similar manner as I added them to OpenGFX, too. See attached (hackish) diff. It'll need at least integration into the existing GUI png file - and as you said: other, smaller, better sprites probably.

Re: [Patch] Town colors in the town list

Posted: 26 Nov 2010 13:31
by Alberth
MagicBuzz wrote:I may change the town list item size to fit the symbols, but I think the symbols should be smaller (10x10), so I don't have to change the list items size.
In general, making assumptions on sizes of text or graphics is wrong. People may develop bigger graphics and/or use a non-standard font size.

Your patch should work with every size graphics and text.

Edit: You also should reverse rendering in case of a RTL language.

Re: [Patch] Town colors in the town list

Posted: 26 Nov 2010 16:39
by MagicBuzz
Here is a new version of my working copy.

I worked on the RTL languages supports.
I worked also on dynamic sprite width, so the player can choose an alternate GRF file.

I still not worked in the dynamic sprite heigth, as for me the sprites must not make the line items larger.
=> This would consume a lot of work time for me to manage this, while I think having big sprites mixed with text is a "bug". If people wants their big sprite to be correctly drawn, they just have to increase font size until it fits the sprite size.

You can see in the screenshot of my tests that the Arabic language has a larger heigth than US English, and we see a larger piece of the sprites each line : the patch actually resize list items successfully according the font size.

-- Edit : Fixed a small offset in RTL language support between the two symbols columns.

Re: [Patch] Town colors in the town list

Posted: 26 Nov 2010 17:06
by michael blunck
MagicBuzz wrote:Here is a new version of my working copy.

Image
@MagicBuzz
Except from the workload, this will always look bad. Get rid of the symbols and include simple coloured rectangles (green .. orange .. red) in front of the town names.

regards
Michael

Re: [Patch] Town colors in the town list

Posted: 26 Nov 2010 17:11
by planetmaker
michael blunck wrote: Except from the workload, this will always look bad. Get rid of the symbols and include simple coloured rectangles (green .. orange .. red) in front of the town names.
That wouldn't change the code a single bit as it would just be different sprites - which means everyone can use there his/her own by means of static newgrf, independent of whatever base set may offer; in any case the lines will have to adopt their height to the sprite sizes as Alberth already pointed out.