[Patch] Town colors in the town list

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

User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

[Patch] Town colors in the town list

Post 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.
Attachments
Here is an exemple :<br />- Lisieux : City, no rating<br />- Bourg : Simple village, no rating<br />- Chambéry : City, good rating<br />- Dinan : Simple village, good rating<br />- Charolles : City, bad rating<br />- Nice : Simple village, bad rating
Here is an exemple :
- Lisieux : City, no rating
- Bourg : Simple village, no rating
- Chambéry : City, good rating
- Dinan : Simple village, good rating
- Charolles : City, bad rating
- Nice : Simple village, bad rating
citycolor.png (7.51 KiB) Viewed 6213 times
citycolor_r21293.patch
(43.05 KiB) Downloaded 202 times
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: [Patch] Town colors in the town list

Post 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.
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: [Patch] Town colors in the town list

Post 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)?
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: [Patch] Town colors in the town list

Post 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.
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: [Patch] Town colors in the town list

Post 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:
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: [Patch] Town colors in the town list

Post 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.
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: [Patch] Town colors in the town list

Post 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.
I am little, ugly, and nasty. How do you do?
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: [Patch] Town colors in the town list

Post 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 ;)
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: [Patch] Town colors in the town list

Post 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.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: [Patch] Town colors in the town list

Post 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.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: [Patch] Town colors in the town list

Post 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.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [Patch] Town colors in the town list

Post 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.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: [Patch] Town colors in the town list

Post 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 :/)
Attachments
list_town_ratings.patch
(3.43 KiB) Downloaded 161 times
town_rating_symbols.png
town_rating_symbols.png (21.33 KiB) Viewed 5906 times
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [Patch] Town colors in the town list

Post 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.
Attachments
opengfx-nightly-r558M.zip
town status sprites added
(3.3 MiB) Downloaded 186 times
extra sprites
extra sprites
extra-gui-townstatus.png (1.79 KiB) Viewed 5901 times
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: [Patch] Town colors in the town list

Post 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 ?
Attachments
list_town_ratings.patch
(2.74 KiB) Downloaded 179 times
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [Patch] Town colors in the town list

Post 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.
Attachments
update_ttdbase.diff
patch to add sprites to openttd.grf
(288.24 KiB) Downloaded 176 times
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4765
Joined: 09 Sep 2007 05:03
Location: home

Re: [Patch] Town colors in the town list

Post 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.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: [Patch] Town colors in the town list

Post 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.
Attachments
Sprites suggestion for OPenGFX (ok, those are ugly, I already told you I can't draw)
Sprites suggestion for OPenGFX (ok, those are ugly, I already told you I can't draw)
extra-gui-townstatus.png (440 Bytes) Viewed 5833 times
My tests with dinamic sprite width and RTL language support
My tests with dinamic sprite width and RTL language support
town_rating_symbols.png (31.57 KiB) Viewed 5833 times
list_town_ratings_fixed.patch
My working copy patch
(3.41 KiB) Downloaded 211 times
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: [Patch] Town colors in the town list

Post 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
Image
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [Patch] Town colors in the town list

Post 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.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 17 guests