Station ID 0xFF returns error

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
User avatar
Erato
Director
Director
Posts: 525
Joined: 25 May 2015 09:09
Location: The Netherlands

Station ID 0xFF returns error

Post by Erato »

Hey guys.

I figured out how to make long stations work. Now I want to add them to my NewGRF, and it had exactly as many IDs left as I needed.
The last one, of course, has the ID 0xFF, but OpenTTD doesn't appreciate that.

Code: Select all

//!!Error (141): ID 08 4B out of valid range (00..FF).
//!!Fatal Error (47): Offset 7: Invalid property 50.
  493 * 14	 00 04 03 01 ff
        08 "KPPL"    
		0B  02  
		11 00  

  494 * 27	 04 04 FF 01 ff C5 "Long roofed platform" 00    
Is the max number of station tiles an odd number or something stupid?
No pics no clicks. Seriously.
ImageImageImageImageImageImageImage
User avatar
JGR
Tycoon
Tycoon
Posts: 2164
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: Station ID 0xFF returns error

Post by JGR »

Erato wrote: 05 Nov 2020 16:31 Hey guys.

I figured out how to make long stations work. Now I want to add them to my NewGRF, and it had exactly as many IDs left as I needed.
The last one, of course, has the ID 0xFF, but OpenTTD doesn't appreciate that.

Code: Select all

//!!Error (141): ID 08 4B out of valid range (00..FF).
//!!Fatal Error (47): Offset 7: Invalid property 50.
  493 * 14	 00 04 03 01 ff
        08 "KPPL"    
		0B  02  
		11 00  

  494 * 27	 04 04 FF 01 ff C5 "Long roofed platform" 00    
Is the max number of station tiles an odd number or something stupid?
The Action 0 ID field is an extended byte, see: https://newgrf-specs.tt-wiki.net/wiki/Action0 and https://newgrf-specs.tt-wiki.net/wiki/G ... nformation.
You'll need something like FF FF 00 instead of FF.
Ex TTDPatch Coder
Patch Pack, Github
Dad-Coder since April 2018

Avatar by MoonsongWolf
User avatar
Erato
Director
Director
Posts: 525
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Station ID 0xFF returns error

Post by Erato »

JGR wrote: 05 Nov 2020 17:42 The Action 0 ID field is an extended byte, see: https://newgrf-specs.tt-wiki.net/wiki/Action0 and https://newgrf-specs.tt-wiki.net/wiki/G ... nformation.
You'll need something like FF FF 00 instead of FF.
I don't have that kind of freedom in m4nfo sadly. The rest of my tiles all just have the normal hex code there, like this:

Code: Select all

  491 * 14	 00 04 03 01 fc
        08 "KPPL"   
		0B  02 
		11 00  

  492 * 27	 04 04 FF 01 fc C5 "Long roofed platform" 00    
OpenTTD has no issues with this.
No pics no clicks. Seriously.
ImageImageImageImageImageImageImage
User avatar
JGR
Tycoon
Tycoon
Posts: 2164
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: Station ID 0xFF returns error

Post by JGR »

Erato wrote: 05 Nov 2020 17:53
JGR wrote: 05 Nov 2020 17:42 The Action 0 ID field is an extended byte, see: https://newgrf-specs.tt-wiki.net/wiki/Action0 and https://newgrf-specs.tt-wiki.net/wiki/G ... nformation.
You'll need something like FF FF 00 instead of FF.
I don't have that kind of freedom in m4nfo sadly. The rest of my tiles all just have the normal hex code there, like this:

Code: Select all

  491 * 14	 00 04 03 01 fc
        08 "KPPL"   
		0B  02 
		11 00  

  492 * 27	 04 04 FF 01 fc C5 "Long roofed platform" 00    
OpenTTD has no issues with this.
It's nothing to do with m4nfo.
Your NFO is incorrect because the action 0 ID field which you want to set to the value FF is an extended byte. You cannot use the one byte form to encode this value, you must use the three byte form. This is as per the specification.
Ex TTDPatch Coder
Patch Pack, Github
Dad-Coder since April 2018

Avatar by MoonsongWolf
User avatar
Erato
Director
Director
Posts: 525
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Station ID 0xFF returns error

Post by Erato »

JGR wrote: 05 Nov 2020 20:07 It's nothing to do with m4nfo.
Your NFO is incorrect because the action 0 ID field which you want to set to the value FF is an extended byte. You cannot use the one byte form to encode this value, you must use the three byte form. This is as per the specification.
I think you don't understand m4nfo. I don't control what the output NFO looks like at all. I can't make it an extended byte.

I just reckoned that by posting the NFO I'd get a more helpful response.

But yeah that basically confirms that it can't be done in m4nfo, a shame, but it's fine.
Thanks for your help.
No pics no clicks. Seriously.
ImageImageImageImageImageImageImage
User avatar
JGR
Tycoon
Tycoon
Posts: 2164
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: Station ID 0xFF returns error

Post by JGR »

Erato wrote: 05 Nov 2020 20:25
JGR wrote: 05 Nov 2020 20:07 It's nothing to do with m4nfo.
Your NFO is incorrect because the action 0 ID field which you want to set to the value FF is an extended byte. You cannot use the one byte form to encode this value, you must use the three byte form. This is as per the specification.
I think you don't understand m4nfo. I don't control what the output NFO looks like at all. I can't make it an extended byte.

I just reckoned that by posting the NFO I'd get a more helpful response.

But yeah that basically confirms that it can't be done in m4nfo, a shame, but it's fine.
Thanks for your help.
Ah I see now, fair enough. If you raise it with mb directly, he may well be able to sort this out on the m4nfo side.
Ex TTDPatch Coder
Patch Pack, Github
Dad-Coder since April 2018

Avatar by MoonsongWolf
michael blunck
Tycoon
Tycoon
Posts: 5883
Joined: 27 Apr 2005 07:09
Contact:

Re: Station ID 0xFF returns error

Post by michael blunck »

JGR wrote: The Action 0 ID field is an extended byte, see: https://newgrf-specs.tt-wiki.net/wiki/Action0 and https://newgrf-specs.tt-wiki.net/wiki/G ... nformation.
The nfo docs on the wiki are misleading.

IIRC, the first feature getting extended their ID range was sounds (already in ttd times), then vehicles in OTTD.
However, from the beginning, being all on the same text line with stations, they got marked by that (*).

But I've never read about station ID range being extended beyond 255.

Anyway, in r31 I've added this in m4nfo functions definestation(), makestation(), and layout() (maybe there's more ID usage?).

However, I did not test it, rather than successfully compile my own NewStations grf.

@erato
Please try with r31, and report any problems.

regards
Michael
Image
User avatar
Erato
Director
Director
Posts: 525
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Station ID 0xFF returns error

Post by Erato »

michael blunck wrote: 06 Nov 2020 09:09
JGR wrote: The Action 0 ID field is an extended byte, see: https://newgrf-specs.tt-wiki.net/wiki/Action0 and https://newgrf-specs.tt-wiki.net/wiki/G ... nformation.
The nfo docs on the wiki are misleading.

IIRC, the first feature getting extended their ID range was sounds (already in ttd times), then vehicles in OTTD.
However, from the beginning, being all on the same text line with stations, they got marked by that (*).

But I've never read about station ID range being extended beyond 255.

Anyway, in r31 I've added this in m4nfo functions definestation(), makestation(), and layout() (maybe there's more ID usage?).

However, I did not test it, rather than successfully compile my own NewStations grf.

@erato
Please try with r31, and report any problems.

regards
Michael
Thanks for taking your time to help me, the nfo generated by this is

Code: Select all

  493 * 16	 00 04 03 01 ff ff 00
        08 "KPPL"    
		0B  02  
		11 00  
It's no longer picked on by nforenum, but OpenTTD doesn't seem to like it
Image
No pics no clicks. Seriously.
ImageImageImageImageImageImageImage
michael blunck
Tycoon
Tycoon
Posts: 5883
Joined: 27 Apr 2005 07:09
Contact:

Re: Station ID 0xFF returns error

Post by michael blunck »

Ah yes.
@JGR
Is that really implemented for stations?
Var68 has only 8 bits for station ID?

regards
Michael
Image
User avatar
JGR
Tycoon
Tycoon
Posts: 2164
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: Station ID 0xFF returns error

Post by JGR »

michael blunck wrote: 06 Nov 2020 14:41 Ah yes.
@JGR
Is that really implemented for stations?
Var68 has only 8 bits for station ID?

regards
Michael
I had another dig through the source and it seems that station ID/spec slots are capped at 255 (not 256) per GRF, so it seems that you can't use 255 as an ID after all.
See: https://github.com/OpenTTD/OpenTTD/blob ... f.cpp#L302
Sorry about time wasted trying to get this working.
michael blunck wrote: 06 Nov 2020 09:09 The nfo docs on the wiki are misleading.

IIRC, the first feature getting extended their ID range was sounds (already in ttd times), then vehicles in OTTD.
However, from the beginning, being all on the same text line with stations, they got marked by that (*).

But I've never read about station ID range being extended beyond 255.
There is only one action 0 parser, and all action 0 features have the same format.
It is an extended byte for all features, even if the usable ID range can be encoded in one byte.
See: https://github.com/OpenTTD/OpenTTD/blob ... 4709-L4746
Ex TTDPatch Coder
Patch Pack, Github
Dad-Coder since April 2018

Avatar by MoonsongWolf
User avatar
Erato
Director
Director
Posts: 525
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Station ID 0xFF returns error

Post by Erato »

JGR wrote: 06 Nov 2020 19:50 I had another dig through the source and it seems that station ID/spec slots are capped at 255 (not 256) per GRF, so it seems that you can't use 255 as an ID after all.
See: https://github.com/OpenTTD/OpenTTD/blob ... f.cpp#L302
Sorry about time wasted trying to get this working.
That is such a shame. I need exactly 256 IDs for this one NewGRF. But that's fine. I'll just move some stuff over to another NewGRF.

Thanks michael and JGR for taking your time to try to help me out.
No pics no clicks. Seriously.
ImageImageImageImageImageImageImage
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 3 guests