Action 14: static newgrf information

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

Moderator: Graphics Moderators

Post Reply
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Action 14: static newgrf information

Post by Yexo »

Action14 is a new newgrf action, supported in OpenTTD since r20257. The point of this action is to provide some extra (static) information. Current features include:
  • Translatable grf name and description
  • Translatable name/description for parameters
  • Setting the version of the grf
  • Extra information for each parameter (type (bool/int), min/max value, names (=one-word description) for some values so it works as an enum)
  • Setting the palette the grf needs
Technical documentation for how it works can be found on the wiki: http://wiki.ttdpatch.net/tiki-index.php?page=Action14
If someone who can edit the table of contents reads this, please at it there.
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Action 14: static newgrf information

Post by eis_os »

I added it, but really I don't like the format, I don't how you you are able to skip unknown feature chunks without knowing it's byte length. If you find an unknown chunk you need to skip the whole action, thats simple broken by design.

Somehow I have the bad feeling someone tried to replicate xml in nfo, thats not nice.


PS: Please don't tell me the Zeros, there is a mix of bytes/words/strings, without knowing a subset you won't be able to parse this mix.
Last edited by eis_os on 31 Jul 2010 15:17, edited 1 time in total.
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Action 14: static newgrf information

Post by Yexo »

You can't skip an unknown chunk-type, but you can unknown ids for valid chunk types because the length of each chunk is known (for text, read until the first 0-byte, for binary nodes the length is the first word of the data, for branch chunks just skip all subchunks).
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Action 14: static newgrf information

Post by eis_os »

Ok, but I think this format feels still broken...


14 "C" "INFO"
"C" "PARA"
"C" \d<setting-number>
"B" "MASK" \w<length> \b <grf-parameter> [ \b <first-bit> [ \b <num-bit> ] ]
00
00
00
00

How you skip this? Identifier may be 00 00 00 00, you have to parse the chunks?
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 991
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Action 14: static newgrf information

Post by frosch »

Like that:
http://hg.openttd.org/openttd/trunk.hg/ ... .cpp#l6220

The ability to skip unknown stuff is the central point of action 14. Without that requirement action 0 would have been used.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 27 guests