{COMPANY_COLOUR} string control code patch

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

Post Reply
xarick
Transport Coordinator
Transport Coordinator
Posts: 336
Joined: 26 Feb 2015 00:52

{COMPANY_COLOUR} string control code patch

Post by xarick »

Created this control code thing so that game scripts could get a way to retrieve company colours with StringID's.
Image
Formerly known as Samu
KeldorKatarn
Transport Coordinator
Transport Coordinator
Posts: 274
Joined: 13 Apr 2010 21:31

Re: {COMPANY_COLOUR} string control code patch

Post by KeldorKatarn »

Can I suggest you rename that to COMPANY_COLOR_NAME or something? COMPANY_COLOR should possibly reserved for using the actual color to color the text.
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1729
Joined: 30 Mar 2005 09:43

Re: {COMPANY_COLOUR} string control code patch

Post by peter1138 »

Yeah, when he was discussing this I thought that was what he was doing as well :-)

I've done a git branch that adds this. I've not tested the either control code myself.
https://github.com/PeterN/OpenTTD/commi ... ontrolcode
He's like, some kind of OpenTTD developer.
KeldorKatarn
Transport Coordinator
Transport Coordinator
Posts: 274
Joined: 13 Apr 2010 21:31

Re: {COMPANY_COLOUR} string control code patch

Post by KeldorKatarn »

Neat, I might cherry pick those :)

Btw, I noticed that {PREVIOUS_COLOR} is for some reason not active, at least not in my fork, I didn't check vanilla yet. But since it's missing in JGR's fork also, I'd almost assume it's in vanilla too:

https://github.com/KeldorKatarn/OpenTTD ... c18a751c54

The logic for it is in place, so there's no reason why it shouldn't be in that table. I'm using it in my fork for something and it works fine. (The name of that code is the reason why I think COMPANY_COLOUR should indeed be a color, otherwise devs will get confused.)
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1729
Joined: 30 Mar 2005 09:43

Re: {COMPANY_COLOUR} string control code patch

Post by peter1138 »

Interesting catch. PREVIOUS_COLOUR is used internally when making negative cash show as red, but never external. It could be potentially be useful though.

By the way, you used spaces instead of tab so I can't cherry-pick that.
He's like, some kind of OpenTTD developer.
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1729
Joined: 30 Mar 2005 09:43

Re: {COMPANY_COLOUR} string control code patch

Post by peter1138 »

Ok, I dropped the COMPANY_COLOUR stuff, after I realised the text colours don't align with company colours at all. (And my revision to the company colour name stuff doesn't work either.)
He's like, some kind of OpenTTD developer.
KeldorKatarn
Transport Coordinator
Transport Coordinator
Posts: 274
Joined: 13 Apr 2010 21:31

Re: {COMPANY_COLOUR} string control code patch

Post by KeldorKatarn »

I'll take a look at some point. Maybe I can figure it out. I have some other work on my plate right now though.
Regarding the spaces.. well spaces are kinda the standard, at least on whatever code I worked. But switching to tabs should be a simple "reformat code section" call in any IDE of your choosing, so reformatting that shouldn't be an issue.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 13 guests