citymania-org / grf-py

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

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

Closed ahyangyi closed 1 year ago

ahyangyi commented 1 year ago

Some notes:

ldpl commented 1 year 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 1 year 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 1 year 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 1 year ago

Confirmed and code updated.

ldpl commented 1 year ago

Confirmed and code updated.

Did you confirm that persistent strings ignore feature?

ahyangyi commented 1 year ago

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

ldpl commented 1 year 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.