Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Tue Feb 28, 2017 2:36 pm

All times are UTC




Post new topic  Reply to topic  [ 70 posts ]  Go to page 1 2 3 4 Next
Author Message
PostPosted: Mon Mar 30, 2009 9:53 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
The idea around this patch is based on Progman's Town rating indicator patch, taking users and devs comments into account. Without knowing it, the patch does this in a similar way than Vikthor's Local authority rating in town label patch. I have adopted some fixes and improvements from the Russian OpenTTD Community patchpack.

Essentialy, the patch uses a colour code in the population part of the town label to show the current rating. If the window is zoomed out, the complete town label will have a changed colour. When the rating at a town changes, the colour is updated accordingly.

Currently the colour scheme is:

Red: Appalling and Very poor ratings.
Orange: Poor and mediocre ratings.
Yellow: Good rating.
White: Very Good rating (standard).
Green: Excellent and outstanding ratings.

Here's a screenshot showing all ratings:

Attachment:
colour.png
colour.png [ 81.46 KiB | Viewed 12513 times ]


Version history

  • v13-r17745: Update to current trunk. Version format changed to fit the used at the rest of my patches. Some code cleanup and simplifications.

  • v12-r17558: Update to current trunk. Fixed an incorrect string.

  • v11: Patch renamed, and almost completely remade. The patch uses only standard colours, and because of that now the code is way more simple. Added comments and fixed a situation in which the correct ratings weren't shown.

  • v10: Update to current trunk. Critical parts of the patch have been remade to be both faster and easier to read. This version is the last one with a colour for each rating. You can download this version here.

  • v09: Update to current trunk. Coding style corrected, including trailing whitespaces (I hope they are out now). Statements to check current rating changed to a better solution that is already used in other parts of OpenTTD code. TownRatingColour implemented as a member of the Town class. Unified some duplicated code. Thanks, Hirundo!

  • v08: (Minor) update to trunk.

  • v07: Update to trunk. Added version for stable 0.7.0 (which is essentially identical to v0.6).

  • v06: Symbol version removed: you still can find the v0.5 version here. Now only the population is coloured. Setting option merged with "show population". Fixed a bug where the colour won't update after town growth. Made sure that the patch can be applied to 0.7.

  • v05: I finally found why _current_company != _local_company. Because of this bug, when the game just commenced the town names were white. A more exact colour scheme is introduced. The code have been almost completely remade to be more efficient (no longer it needs to calculate the colour each time the sign is drawn, only when the rating changes).

  • v04: Colour scheme changed again. Ratings are now shown with 4x and 8x zoom-out. Symbol-only version released.

  • v03: Colour scheme changed for better readability. Code changed to work only with colours instead of completely different string IDs. Use always the white colour while playing as spectator. Fixed some indentation errors.

  • v02: Added patch option to activate / deactivate this option. Now everytime that a town rating is changed, that town's sign is updated.

  • v01: Initial release


Attachments:
rating_town_label_r18684.diff [7.31 KiB]
Downloaded 395 times
rating_town_label_v13-r18762.rar [3.02 MiB]
Downloaded 400 times

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Last edited by Terkhen on Sat Jan 09, 2010 1:07 pm, edited 35 times in total.
Top
   
PostPosted: Mon Mar 30, 2009 10:45 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Sat Jan 03, 2009 5:55 pm
Posts: 301
Very nice idea Terkhen!
This will be my favourite patch ;)
Oh and I bet, in 6 hours the first demands for the KGATPP are coming in :D


Last edited by Timmaexx on Sun Apr 19, 2009 6:07 pm, edited 1 time in total.

Top
   
PostPosted: Tue Mar 31, 2009 12:45 am 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 6897
what's a must-of?

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Tue Mar 31, 2009 9:47 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
New version posted: see first post for details.

@Eddi: I suppose he means a "must-have". Thank you Timmaexx!

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Top
   
PostPosted: Tue Mar 31, 2009 11:52 pm 
Offline
Chief Executive
Chief Executive

Joined: Sun Nov 11, 2007 12:06 pm
Posts: 658
I had a look at this patch and it looks nice but not all the coulours work all the time it be nice to see what the rateings for each palyer not just one get a setting to show yours and everones who run in that town

_________________
For Community Integrated Version http://code.google.com/p/civopenttd/


Top
   
PostPosted: Wed Apr 01, 2009 9:15 am 
Offline
Engineer
Engineer

Joined: Sun Jun 13, 2004 4:57 pm
Posts: 69
Location: Prague, Czech republic
It's interesting how some ideas emerge again and again. I made similar patch over a year ago. I wish you luck and I hope you will be more successful in getting it commited.


Top
   
PostPosted: Wed Apr 01, 2009 9:34 am 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
@2007Alain2007: I'm not sure I understood what you meant, but the aim of this patch is to provide info about ratings while building near a city. That way, you don't have to open the ratings window and have it occupying screen space. If you need to check ratings for other companies, the best solution is just to look at the ratings window.

@Vikthor: It's incredible: I hadn't seen your patch but after reading it, I see that we reached almost the same solution. I added a link to your work in the first post. Thanks for your support!.

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Top
   
PostPosted: Wed Apr 01, 2009 9:47 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon May 21, 2007 11:47 am
Posts: 6559
Location: The Netherlands
Maybe instead of colours (which make the sign quite unreadable sometimes), you could do something with plusses and minusses.

For instance, add a double plus (++) at the end of the town label in case of Excellent or Outstanding rating, and along those lines outher ratings could be indicated as follows:

Appalling and Very Poor: --
Poor: -
Mediocre: (no indication)
Good and Very Good ratings: +
Excellent and Outstanding: ++

Otherwise I think it's a very nice addition to the game. Keeps me from opening two windows in every town.

_________________
FooBar's Tram Tracks | TransRapid Track Set | Metro Track Set | OpenGFX base graphics set | FIRS Industry Replacement Set
Dutch Tram Set | Dutch Trainset 2 | Dutch Road Furniture


Top
   
PostPosted: Wed Apr 01, 2009 3:30 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Sun Jan 27, 2008 1:02 pm
Posts: 298
Some random comments on the code:

_current_company != _local_company.
Also, both current and local company may not be a valid company. e.g. t->ratings[COMPANY_SPECTATOR] will overflow badly.

Isn't it possible to specify a colour when drawing a string? I think this would be preferable to using many different strings in english.txt.

In some places the code isn't aligned properly w.r.t. tabs/indentation. Read the .diff thoroughly to see what I mean.

_________________
Create your own NewGRF? Check out this tutorial!


Top
   
PostPosted: Wed Apr 01, 2009 3:56 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
I like Foobar's idea: is more readable than using colors. What do other people think?

Swallow: Thanks for your comments. I'll look into the company problem and the indentation errors tonight. I don't know how to use strings that aren't defined at english.txt, but I'll give it a try.

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Top
   
PostPosted: Wed Apr 01, 2009 5:07 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4517
Location: /home/sweden
About choosing what color to draw with. The sign list window uses the following code to draw sign names in yellow. Notice the last argument to DrawString is the colour.
Code:
         SetDParam(0, si->index);
         DrawString(this->widget[SLW_LIST].left + 22, this->widget[SLW_LIST].right, y, STR_SIGN_NAME, TC_YELLOW);


I've checked your patch and see that the town names are drawn using another function "AddStringToDraw", but looking up that function it has two optional parameters. The first optional parameter is named colour. If it works the same as the colour parameter to DrawString, it will override the colour information in the string with the supplied colour.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Sat Apr 04, 2009 3:19 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
I have posted a new version of the patch in the first post. See the changelog for details.

What is your opinion about the new colors?

Zuu: Thanks for your help: I think the code is cleaner now that it works just with colors.

Swallow: I think I fixed everything, except the _current_company and _local_company issue. All functions related to the town sign drawing used _current_company, so I wasn't sure if I had to change it or not.

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Top
   
PostPosted: Sat Apr 04, 2009 5:50 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon May 21, 2007 11:47 am
Posts: 6559
Location: The Netherlands
Terkhen wrote:
What is your opinion about the new colors?

Much better. That blue was just terribly unreadable.

Maybe change the red for orange? That red is a bit 'screamish' compared to the other colours.

_________________
FooBar's Tram Tracks | TransRapid Track Set | Metro Track Set | OpenGFX base graphics set | FIRS Industry Replacement Set
Dutch Tram Set | Dutch Trainset 2 | Dutch Road Furniture


Top
   
PostPosted: Sat Apr 04, 2009 6:17 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
This screenshot shows how it looks after changing red with orange:

Attachment:
orange.png
orange.png [ 92.22 KiB | Viewed 14865 times ]


I prefer orange too. It's not as striking as red, but still shows a bad rating nicely.

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Top
   
PostPosted: Sat Apr 11, 2009 9:28 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Oct 04, 2008 11:05 pm
Posts: 2622
Location: Lost in spaces
I like this patch.
I is much easier to see which towns needs that little extra attention.
Also it prevents me bulldozing and terraforming then to find out i am not allowed to build whatever i was preparing the terrain for.

The only thing that confuses me a little bit is the townname colourchange.

Would it be possible to leave the townname white and only have the townpopulation change colour?
That way we still see the townratings and I am no longer searching for the townname between my station/busstop signs (and other player/ai stations/busstops).

Anyway nice patch.
I hope it hits trunk.

_________________
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.


Top
   
PostPosted: Sat Apr 11, 2009 12:17 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Oct 23, 2006 2:07 am
Posts: 266
Location: Berlin
Hello

ChillCore wrote:
The only thing that confuses me a little bit is the townname colourchange.

Would it be possible to leave the townname white and only have the townpopulation change colour?

That could cause a problem. You can disable the displaying of the townpopulation. Wich element want you to be coloured in this case?

ChillCore wrote:
I hope it hits trunk.

Me too. :-)

Tschö, Auge

_________________
further development of My Little Forum 1


Top
   
PostPosted: Sat Apr 11, 2009 12:25 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Oct 04, 2008 11:05 pm
Posts: 2622
Location: Lost in spaces
Quote:
That could cause a problem. You can disable the displaying of the townpopulation. Wich element want you to be coloured in this case?


None?

I have the grass on tracks in my patchpack and if i disable all details the grass is gone and so is my extra system load.(hint)

_________________
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.


Top
   
PostPosted: Sat Apr 11, 2009 1:56 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Oct 23, 2006 2:07 am
Posts: 266
Location: Berlin
ChillCore wrote:
Quote:
That could cause a problem. You can disable the displaying of the townpopulation. Wich element want you to be coloured in this case?

None?

Oh, sorry. I thought, the patch make it into trunk and should be available for everyone (including those, who disabled the displaying of town population).

Tschö, Auge

_________________
further development of My Little Forum 1


Top
   
PostPosted: Sat Apr 11, 2009 3:43 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Oct 04, 2008 11:05 pm
Posts: 2622
Location: Lost in spaces
Maybe like FooBar suggested adding :

++ + N - --

to/before the townstring.

Its just an idea.
The way it is now it is fine too.
I just have to search a bit longer after the townname sometimes,
because in some of my games i dont let towns build roads so the towname is not always in the center. No biggy

_________________
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.


Top
   
PostPosted: Sat Apr 11, 2009 9:33 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
Both approachs (different color only in town population and adding something at the end of the string) would need a new string in english.txt for each color / symbol to be added. Since that makes the patch more messy, I'd prefer not to add more strings. I think there's a way to pass a string parameter to a string, I'll give it a look soon.

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 70 posts ]  Go to page 1 2 3 4 Next

All times are UTC


Who is online

Users browsing this forum: LabUser and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.