Check player info from industry's var action2

Got an idea for a new feature in TTDPatch? Post it here.

Moderator: TTDPatch Moderators

Post Reply
User avatar
George
Tycoon
Tycoon
Posts: 4306
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: SPb, Russia.
Contact:

Check player info from industry's var action2

Post by George » 23 Aug 2007 05:51

http://wiki.ttdpatch.net/tiki-index.php ... nalAction2
Wiki wrote:Industry founder information (A7)
Since TTDPatch 2.0.1 alpha 74, this byte contains the ID of the company that funded the industry, or 10h if the industry was generated randomly. If the industry was built using an earlier TTDPatch version or with newindustries turned off, this field is 10h.
And would it be possible to get the colour(s) of this player?
If not, could we have one more field in the industry structure - the colour of the company that it had when it have built the industry?
Image Image Image Image

User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Re: Check player info from industry's var action2

Post by Csaboka » 23 Aug 2007 10:30

George wrote:And would it be possible to get the colour(s) of this player?
Yes, it would be easy to return the first (and if present, the second) company color, or a random color if the industry has no owner.
George wrote:If not, could we have one more field in the industry structure - the colour of the company that it had when it have built the industry?
You don't need a second field for that - industries already have a "color" field. We'd just need a new flag in property 1A that makes sure the color of the founder company gets written to this field instead of a random value. You wouldn't even need to care about any details; just enable recoloring without specifying a recolor sprite number, and you get the correct color. You couldn't use the second company color with this, though.

You just need to decide what would be better for you - an industry that changes color when your company changes color, and reverts to a random color on bankrupt, or an industry that gets its color from your current company, but never changes it later.
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick

User avatar
George
Tycoon
Tycoon
Posts: 4306
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: SPb, Russia.
Contact:

Re: Check player info from industry's var action2

Post by George » 23 Aug 2007 16:29

Csaboka wrote:
George wrote:And would it be possible to get the colour(s) of this player?
Yes, it would be easy to return the first (and if present, the second) company color, or a random color if the industry has no owner.
George wrote:If not, could we have one more field in the industry structure - the colour of the company that it had when it have built the industry?
You don't need a second field for that - industries already have a "color" field. We'd just need a new flag in property 1A that makes sure the color of the founder company gets written to this field instead of a random value. You wouldn't even need to care about any details; just enable recoloring without specifying a recolor sprite number, and you get the correct color. You couldn't use the second company color with this, though.
You just need to decide what would be better for you - an industry that changes color when your company changes color, and reverts to a random color on bankrupt, or an industry that gets its color from your current company, but never changes it later.
Never change it later.
Image Image Image Image

User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Re: Check player info from industry's var action2

Post by Csaboka » 23 Aug 2007 19:14

This should be possible now, thanks to DaleStan for industry variable 45 and me for callback 14A. I've decided a new callback is better than a bit in property 1A because it allows more things. For example, you can now limit the list of available colors if your industry wants to use random colors, but doesn't look right in all the 16 colors possible. You don't get second company color support, though. (I'm not sure this would be needed at all.)
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick

User avatar
George
Tycoon
Tycoon
Posts: 4306
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: SPb, Russia.
Contact:

Re: Check player info from industry's var action2

Post by George » 23 Aug 2007 20:45

Csaboka wrote:This should be possible now, thanks to DaleStan for industry variable 45 and me for callback 14A. I've decided a new callback is better than a bit in property 1A because it allows more things. For example, you can now limit the list of available colors if your industry wants to use random colors, but doesn't look right in all the 16 colors possible. You don't get second company color support, though. (I'm not sure this would be needed at all.)
Thank you :)
I'll try to test it tomorrow
Image Image Image Image

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

Re: Check player info from industry's var action2

Post by belugas » 23 Aug 2007 23:30

George, if you can excuse a blunt request, i would be interested testing my own implementation (almost written) of this with your tester :)
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
George
Tycoon
Tycoon
Posts: 4306
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: SPb, Russia.
Contact:

Re: Check player info from industry's var action2

Post by George » 24 Aug 2007 05:34

belugas wrote:George, if you can excuse a blunt request, i would be interested testing my own implementation (almost written) of this with your tester :)
I hope I'll make one today evening
Image Image Image Image

User avatar
George
Tycoon
Tycoon
Posts: 4306
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: SPb, Russia.
Contact:

Re: Check player info from industry's var action2

Post by George » 24 Aug 2007 21:15

Image Image Image Image

Post Reply

Return to “Suggestions”

Who is online

Users browsing this forum: No registered users and 1 guest