Duplicate properties in Action00

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

Moderator: Graphics Moderators

Post Reply
User avatar
UnicycleBloke
Engineer
Engineer
Posts: 63
Joined: 30 Aug 2011 14:39
Location: Cambridge, England

Duplicate properties in Action00

Post by UnicycleBloke »

Does it matter what order Action00 properties appear in? Is it meaningful for an Action00 to contain the same property more than once?

I am seeing cases in dutchtrains.grf in which Trains property 0x1D (refit cargo types) is set multiple times, after various other cargo related properties are set. The value appears to be the same for each repeat, so I guess that's fine. Perhaps some artifact from NML processing...

But I have other examples in which property 0x26 (retire vehicle early) is first set to a non-zero value, and later set to 0 in the same Action00. I thought this might be unintended but it appears explicitly in the NML. Unless that code is itself generated and this is an artifact of that...

Cheers.

User avatar
jfs
Tycoon
Tycoon
Posts: 1241
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Duplicate properties in Action00

Post by jfs »

Good old answer "it depends".

For most Action 0, property 8 always needs to be first, and after that it doesn't matter too much.
In general, properties are (in OpenTTD) applied in the order they are specified, and if one property is repeated the later values will overwrite the previous.

There may be some more properties that are sensitive to order, but I can't think of any off the top of my head.

User avatar
UnicycleBloke
Engineer
Engineer
Posts: 63
Joined: 30 Aug 2011 14:39
Location: Cambridge, England

Re: Duplicate properties in Action00

Post by UnicycleBloke »

Thanks jfs. I've had a little dig around in the OpenTTD source, and it looks as if the property order doesn't matter, and that duplicates don't matter. The values are read from the GRF after switching on the property index, and all the reads appear to be orthogonal, overwriting whatever the previous value was. So that's good to know.

Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 2 guests