[Patch]Local authority rating in town label

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

Vikthor
Engineer
Engineer
Posts: 69
Joined: 13 Jun 2004 16:57
Location: Prague, Czech republic

[Patch]Local authority rating in town label

Post by Vikthor »

This patch adds option for displaying rating local player has in town in(or rather just under) town name label. You can see direct feedback of your actions, without having to have town window opened. It's useful especially when working near more cities, where your screen could be pretty cluttered. This patch does not bump savegame version, it saves setting in cfg.
Attachments
rating_r12304_svn.diff
(7.68 KiB) Downloaded 270 times
Falco00
Engineer
Engineer
Posts: 4
Joined: 28 Feb 2008 12:56

Re: [Patch]Local authority rating in town label

Post by Falco00 »

Works great, now i can finally see how many trees i have to build to get a good rating :D

Using a second line of text is a bit too much tho, maybe change it into a smiley or a simple collored dot behind the townname.
Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Patch]Local authority rating in town label

Post by Trond »

Works like a charm as far as I can tell. However, I dont see any need for an empty line between townname and rating atleast. Besides that I like it! Also a plus that it uses strings already there, so its already in my language.
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: [Patch]Local authority rating in town label

Post by Bilbo »

Very nice and well commented patch. Just I thought of one improvement - if the rating is too low to build stations, perhaps print the rating in yellow to alert about the problem? Or maybe even use different colors for different ratings (some color scale like red - orange - yellow - light green - dark green - white - light blue - dark - blue or alike ... )
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)
User avatar
Maedhros
OpenTTD Developer
OpenTTD Developer
Posts: 603
Joined: 30 Mar 2006 18:24
Location: Durham, UK

Re: [Patch]Local authority rating in town label

Post by Maedhros »

What happens when you're watching a network game as a spectator?
No-one's more important than the earthworm.
Vikthor
Engineer
Engineer
Posts: 69
Joined: 13 Jun 2004 16:57
Location: Prague, Czech republic

Re: [Patch]Local authority rating in town label

Post by Vikthor »

Falco00 wrote:Using a second line of text is a bit too much tho, maybe change it into a smiley or a simple collored dot behind the town name.
Hmm, maybe it could be patch setting, perhaps I could reuse the dot in server-list window.
On the other hand i don't want to bloat the patch too much.
Trond wrote:However, I dont see any need for an empty line between town name and rating at least.
That line is there because it has to be displayed correctly on two zoom levels, if I take it out, in normal zoom, it would overlap on the second AFAIK.
Bilbo wrote:Very nice and well commented patch.
Thanks, in fact I was not sure about the code, so I posted it here, to get some comments before I post to FS.
Bilbo wrote:if the rating is too low to build stations, perhaps print the rating in yellow to alert about the problem? Or maybe even use different colors for different ratings (some color scale like red - orange - yellow - light green - dark green - white - light blue - dark - blue or alike ... )
This would require to make a few strings of style {GREEN} {STRING}, {RED}{STRING} etc. and then choose appropriate one. Or is there something along the line {COLOUR} and pass colour as a parameter?(If not, this is idea for patch).
Maedhros wrote:What happens when you're watching a network game as a spectator?

I hope nothing, the rating is not drawn, I used this

Code: Select all

if (_patches.rating_in_label && HasBit(t->have_ratings,_local_player))
and spectator should not have rating in any city.
Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Patch]Local authority rating in town label

Post by Trond »

Vikthor wrote:
Trond wrote:However, I dont see any need for an empty line between town name and rating at least.
That line is there because it has to be displayed correctly on two zoom levels, if I take it out, in normal zoom, it would overlap on the second AFAIK.
Yes, you're right, I just checked it.

I agree with bilbo's idea, a colorscheme to match the rating wuld be really nice! But not sure you can make that and still keep the same strings so my language text is already there, but I can live with that :) (but maybe it lowers chance to get it into trunk? I sure hope it will get into trunk, because this is really a great addition).
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Re: [Patch]Local authority rating in town label

Post by richk67 »

Great idea. It may look better - more discrete - if the rating were displayed as a graphic. I would suggest a coloured meter bar (like a progress bar) that starts at dark red at left, and goes via red, orange, yellow, light green, green, blue, etc. for the various rating levels. This way, the rating is displayed in the same amount of space regardless of the user's language settings.
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
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: [Patch]Local authority rating in town label

Post by PhilSophus »

Just a side note: There used to be some patch where a change in rating was displayed as a rising green or red text (the same way as incomes/expenses are). I agree that being able to also see the current rating without a change is even better.

As for the colors: I would prefer using only colors between red and green (i.e. hues of red, orange, yellow, green) as these are intuitively understandable (even if that means assigning the same color to multiple rating levels). I don't think that blue or white would be that clear.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
Vikthor
Engineer
Engineer
Posts: 69
Joined: 13 Jun 2004 16:57
Location: Prague, Czech republic

Re: [Patch]Local authority rating in town label

Post by Vikthor »

richk67 wrote:It may look better - more discrete - if the rating were displayed as a graphic. I would suggest a coloured meter bar (like a progress bar) that starts at dark red at left, and goes via red, orange, yellow, light green, green, blue, etc. for the various rating levels.
I have tried this, so far not with a bar but with blop from server list. It should display green for ratings good and better, yellow for poor and better and red for the rest. The problem is, it shows nothing at all. My bet is that it gets overwritten with other sprites, I do not know if DrawSprite is right function to use. If somebody has better experience with how the sprites work in OTTD, please tell me.
Attachments
lameter_r12320.diff
output of git diff, apply with -p1 or edit out "a/" and "b/" prefixes from path
(4.35 KiB) Downloaded 194 times
Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Patch]Local authority rating in town label

Post by Trond »

How about using the colors on the cityname itself? Green cityname for good rating and red cityname for bad, and then the yellowish inbetween?
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish
Vikthor
Engineer
Engineer
Posts: 69
Joined: 13 Jun 2004 16:57
Location: Prague, Czech republic

Re: [Patch]Local authority rating in town label

Post by Vikthor »

Also a possibility, for now you can't turn population off if you use this, it may change in future(I may add other strings, or maybe somebody can suggest better solution?). OK now we have 2(3 if I can get the sprites to show) options how to do it, now we have to choose the best from them, so any comments?
Attachments
towncolourlabel_r12324.diff
output of git diff, apply with -p1 or edit out "a/" and "b/" prefixes from path
(5.5 KiB) Downloaded 194 times
Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Patch]Local authority rating in town label

Post by Trond »

Vikthor wrote:Also a possibility, for now you can't turn population off if you use this, it may change in future(I may add other strings, or maybe somebody can suggest better solution?). OK now we have 2(3 if I can get the sprites to show) options how to do it, now we have to choose the best from them, so any comments?
Sorry, but I'm not familiar with this kinda patch. Tortoise complains about some missing index line, and BOTTD just tells me its an unrecognized patch... So I cant see what it looks like, nor test it. If anyone feel like making a svn patch of it that would be really neat.

Also, eventough I havent seen it yet, I've was thinking this could be confusing if you play red or green CC and townnames get the same colors... This is just in my head so far, as I still havent got to test it :)
Last edited by Trond on 04 Mar 2008 08:22, edited 1 time in total.
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish
User avatar
Zhall
Tycoon
Tycoon
Posts: 1237
Joined: 17 Jul 2007 01:36
Skype: moonray_zdo
Location: Teh matrix, duh.
Contact:

Re: [Patch]Local authority rating in town label

Post by Zhall »

Why not have all the information? XD
Vikthor
Engineer
Engineer
Posts: 69
Joined: 13 Jun 2004 16:57
Location: Prague, Czech republic

Re: [Patch]Local authority rating in town label

Post by Vikthor »

Is there some standard for .diff? If so, somebody should report it either to TortoiseSVN or Git.
Anyway, here is SVN diff.
Sapphire united wrote:Why not have all the information? XD
The problem is now it shows either all the information(town namer+rating + population) or town name + pop. or only town name, it's currently impossible to show town name + rating, but maybe it does not matter, or maybe I will change after we settle which option to show rating is best to use.
Attachments
towncolourlabel_r12324_SVN.diff
(5.3 KiB) Downloaded 183 times
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Patch]Local authority rating in town label

Post by Roujin »

Well, maybe not a standard, but I think more people are able to apply SVN diffs than another format. Also because of the tool BuildOTTD, which understands SVN diffs only.
* @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
Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Patch]Local authority rating in town label

Post by Trond »

That works out really well for me tbh, only thing I did notice is that its only the 2 innermost zooms that will color the name, not a big deal, just noticed it... Anyway, I like it :)

EDIT: Cant you just put in both/all methods and make an option so people can choose how they like it? Just use arrow to select it in patch config window. Under Cityname/Colored Cityname/Bar With Blop/Sprites/more options. That way you will still also use only one line on the patchconfig window...
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: [Patch]Local authority rating in town label

Post by Ammler »

Screeens available for lazy guys like me? ;-)
Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Patch]Local authority rating in town label

Post by Trond »

Rating under cityname
Rating under cityname
Clipboard01.png (56.32 KiB) Viewed 7795 times
Rating colors cityname
Rating colors cityname
Clipboard02.png (34.73 KiB) Viewed 7791 times
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish
Vikthor
Engineer
Engineer
Posts: 69
Joined: 13 Jun 2004 16:57
Location: Prague, Czech republic

Re: [Patch]Local authority rating in town label

Post by Vikthor »

Trond wrote:That works out really well for me tbh, only thing I did notice is that its only the 2 innermost zooms that will color the name, not a big deal, just noticed it... Anyway, I like it :)
I know, but adding it for more zoomed out levels would require even more new strings, I don't know if it is good idea.
Trond wrote: EDIT: Cant you just put in both/all methods and make an option so people can choose how they like it? Just use arrow to select it in patch config window. Under Cityname/Colored Cityname/Bar With Blop/Sprites/more options. That way you will still also use only one line on the patchconfig window...
OpenTTD devs stated that they don't see need for everything to be set by patch settings. I think we can reach consensus on which option is best and use it. It is doable but it would complicate things for me and for anybody who would review that patch.
EDIT: I got a request for update, so here it is(only coloured townlabel) - not that there was much to update :D
Attachments
lacolourlabe_r12346_SVN.diff
(5.3 KiB) Downloaded 189 times
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 15 guests