Page 1 of 1

Duplicate properties in Action00

Posted: 05 Dec 2019 21:25
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.

Re: Duplicate properties in Action00

Posted: 06 Dec 2019 13:11
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.

Re: Duplicate properties in Action00

Posted: 08 Dec 2019 22:33
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.