
{COMPANY_COLOUR} string control code patch
Moderator: OpenTTD Developers
{COMPANY_COLOUR} string control code patch
Created this control code thing so that game scripts could get a way to retrieve company colours with StringID's.


Formerly known as Samu
-
- Transport Coordinator
- Posts: 274
- Joined: 13 Apr 2010 21:31
Re: {COMPANY_COLOUR} string control code patch
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.
Re: {COMPANY_COLOUR} string control code patch
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

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.
-
- Transport Coordinator
- Posts: 274
- Joined: 13 Apr 2010 21:31
Re: {COMPANY_COLOUR} string control code patch
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.)

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.)
Re: {COMPANY_COLOUR} string control code patch
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.
By the way, you used spaces instead of tab so I can't cherry-pick that.
He's like, some kind of OpenTTD developer.
Re: {COMPANY_COLOUR} string control code patch
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.
-
- Transport Coordinator
- Posts: 274
- Joined: 13 Apr 2010 21:31
Re: {COMPANY_COLOUR} string control code patch
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.
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.
Who is online
Users browsing this forum: Bing [Bot] and 12 guests