Page 1 of 1

Check player info from industry's var action2

Posted: 23 Aug 2007 05:51
by George
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?

Re: Check player info from industry's var action2

Posted: 23 Aug 2007 10:30
by Csaboka
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.

Re: Check player info from industry's var action2

Posted: 23 Aug 2007 16:29
by George
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.

Re: Check player info from industry's var action2

Posted: 23 Aug 2007 19:14
by Csaboka
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.)

Re: Check player info from industry's var action2

Posted: 23 Aug 2007 20:45
by George
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

Re: Check player info from industry's var action2

Posted: 23 Aug 2007 23:30
by belugas
George, if you can excuse a blunt request, i would be interested testing my own implementation (almost written) of this with your tester :)

Re: Check player info from industry's var action2

Posted: 24 Aug 2007 05:34
by George
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

Re: Check player info from industry's var action2

Posted: 24 Aug 2007 21:15
by George