citymania-org / grf-py

A Python framework for making NewGRFs for OpenTTD
GNU General Public License v2.0
14 stars 3 forks source link

Add support for "persistent IDs" (the DCxx IDs) #8

Closed ahyangyi closed 11 months ago

ahyangyi commented 12 months ago

Some notes:

ldpl commented 12 months ago

What are you trying to do with those strings that can't be done with 0xD0xx? Also, iirc feature doesn't matter for 0xD0xx range.

ahyangyi commented 12 months ago

A few RoadType properties are strings. They can't seem to use 0xD0xx strings during my tests.

The documentation about 0xDCxx also states:

Unlike the D0xx GRF texts, these IDs can be used to set properties. The text ID must be set before any action 0 references it.

My current usage of such persistent strings can be seen here.

ahyangyi commented 12 months ago

Hmm, the dict-in-dict implementation might be wrong if 0xDCxx doesn't care about the feature tag either... I should confirm it.

ahyangyi commented 12 months ago

Confirmed and code updated.

ldpl commented 11 months ago

Confirmed and code updated.

Did you confirm that persistent strings ignore feature?

ahyangyi commented 11 months ago

I tested that RoadType Action0 can use persistent strings defined with grf.TRAIN

ldpl commented 11 months ago

Ok, I'm not really happy with global strings api but for now it will do. Eventually I'll try to make it so that you can just use string and framework will handle allocation on its own.