Patch: Town rating indicator

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

Progman
Engineer
Engineer
Posts: 76
Joined: 15 Jul 2006 12:55
Contact:

Patch: Town rating indicator

Post by Progman »

I have written a patch which shows changes of rating for a town. It adds an entry in the patch settings, the patch is disabled by default.

Update: Fixed the overlapping raising messages by offset the positions for each kind of rating.
Update2: Added new patch which creates a OffsetByTownRating function, this patch now use this.
Update3: Fixed a bug where town ratings of all players are shown
Attachments
Example how it looks
Example how it looks
townrating_indicator.png (137.05 KiB) Viewed 7735 times
OffsetByTownRating.diff
Patch for function OffsetByTownRating()
(2.13 KiB) Downloaded 278 times
townrating_indicator.diff
Patch for town rating indicator (needs OffsetByTownRating patch from this post)
(5.5 KiB) Downloaded 320 times
Last edited by Progman on 07 Sep 2007 21:26, edited 4 times in total.

User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: Patch: Town rating indicator

Post by XeryusTC »

Make screenshots in english please so we can actually read what your rating is now!
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image

User avatar
Zephyris
Tycoon
Tycoon
Posts: 2831
Joined: 16 May 2007 16:59

Re: Patch: Town rating indicator

Post by Zephyris »

Does it float up like the cost?

Progman
Engineer
Engineer
Posts: 76
Joined: 15 Jul 2006 12:55
Contact:

Re: Patch: Town rating indicator

Post by Progman »

yes, it starts above the town name so it doesn't get in conflict with costs for a town action like ads or bribe.

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Patch: Town rating indicator

Post by PhilSophus »

Nice little patch. I often have open the town window while building to watch my rating. This patch would avoid it.

Some small notes if you want to get it into trunk:
  • Use tabs for indentation not spaces. For whitespace within the line use spaces not tabs. (see the coding style for details).
  • The GUI stuff should probably be in a function in town_gui.cpp and only be called from town_cmd.cpp.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008

User avatar
Sir A. Boey
Transport Coordinator
Transport Coordinator
Posts: 299
Joined: 17 Nov 2006 17:40
Location: UTL ~ HQ Vlaanderen

Re: Patch: Town rating indicator

Post by Sir A. Boey »

Great Patch nice idea... :shock:

Hope to see this implemented soon... :wink:
Image
_____________# If you believe in it, you can achieve it" # ____________
__________________# Check out My Closed Platform #___________________

Tom0004
Chairman
Chairman
Posts: 822
Joined: 01 Jul 2007 22:33
Location: Manchester, UK

Re: Patch: Town rating indicator

Post by Tom0004 »

awesome stuff, what does it show, when a town has no rating for you ?

User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Patch: Town rating indicator

Post by belugas »

Interesting feature.
The selection of the StringID based on ratings is now done with 3 times the same code, two times in town_cmd.cpp and one time in town_gui.cpp.
It would be preferable to make it a function, probably an inline one in town.h
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones

Progman
Engineer
Engineer
Posts: 76
Joined: 15 Jul 2006 12:55
Contact:

Re: Patch: Town rating indicator

Post by Progman »

Fixed the overlapping rating messages

User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Patch: Town rating indicator

Post by athanasios »

I also find it very practical. I do not need to have the town window open all the time.
Hope to see it soon into the trunk. :D
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.

TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1312
Joined: 31 May 2004 09:21

Re: Patch: Town rating indicator

Post by TrueBrain »

Maybe it is even more useful to have a small icon next to a town indicating what the town things of you.. like a double -- is bad, and a double ++ is perfect! In between we have -, o, and +. As I always have to open the darn window to see if I should plan a window there or not... just my 2 cents, no idea what other devs think of it ;)
The only thing necessary for the triumph of evil is for good men to do nothing.

Progman
Engineer
Engineer
Posts: 76
Joined: 15 Jul 2006 12:55
Contact:

Re: Patch: Town rating indicator

Post by Progman »

I have added a OffsetByTownRating() function which can be used to get the correct StringID based on the given rating. This function returns an offset between 0 and 7 which must be added to the STR_3035_APPALLING value. I used the StringID return type although this function doesn't return a string from the lang-files. I'm not sure if it is the proper return type, I just try to avoid compiling errors/warnings about type casting with "StringID + int". My patches uses tabs for indents as specific in the coding style. Check the first post for the patch files.

Psistorm
Traffic Manager
Traffic Manager
Posts: 173
Joined: 05 Jun 2004 12:22

Re: Patch: Town rating indicator

Post by Psistorm »

TrueLight wrote:Maybe it is even more useful to have a small icon next to a town indicating what the town things of you.. like a double -- is bad, and a double ++ is perfect! In between we have -, o, and +. As I always have to open the darn window to see if I should plan a window there or not... just my 2 cents, no idea what other devs think of it ;)
I have been thinking about exactly such a thing :D
being able to see the town rating directly in some way would be awesome

User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Patch: Town rating indicator

Post by belugas »

Good work, Progman

TrueLight, I like the idea. Seems like a good bonus :)
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones

User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1203
Joined: 15 Feb 2003 17:32
Location: Villefranche-sur-Saône, France

Re: Patch: Town rating indicator

Post by MagicBuzz »

I just noticed a small "bug".

The rating message is shown for any player. You might add the player name in the message, or don't display the message when the current message isn't aimt for the current player :)

I just got spamed in several cities while an AI opponent was... Just erasing an entire city !
I thought the messages were for me, I almost got an heart attack ;)

Progman
Engineer
Engineer
Posts: 76
Joined: 15 Jul 2006 12:55
Contact:

Re: Patch: Town rating indicator

Post by Progman »

MagicBuzz wrote:The rating message is shown for any player. You might add the player name in the message, or don't display the message when the current message isn't aimt for the current player :)
fixed, added just a "_local_player == _current_player" check

Tom0004
Chairman
Chairman
Posts: 822
Joined: 01 Jul 2007 22:33
Location: Manchester, UK

Re: Patch: Town rating indicator

Post by Tom0004 »

i'd also prefer an option where your rating stays in veiw, like the town name

User avatar
Vaulter
Traffic Manager
Traffic Manager
Posts: 185
Joined: 21 Dec 2004 05:35
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Contact:

Re: Patch: Town rating indicator

Post by Vaulter »

Bumped to trunk (r22604)
added Russian translate.
Attachments
townrating-indicator.r22604M.patch
(9.46 KiB) Downloaded 210 times

User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 675
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: Patch: Town rating indicator

Post by JacobD88 »

Wow, fantastic bump Vaulter, subscribing to this thread as i wasn't aware of this patch.

Thank-you for your continued updates of so many great old patches around the forums, it's greatly appreciated :bow:

Timmaexx
Transport Coordinator
Transport Coordinator
Posts: 301
Joined: 03 Jan 2009 17:55

Re: Patch: Town rating indicator

Post by Timmaexx »

Vaulter wrote:Bumped to trunk (r22604)
Is it hard to bump such an old patch?

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 2 guests