I'm playing around with coding of Firs, but as this is more of a general NML question, I'm asking here. I want to expand the range of automatic names when placing a station near to an industry.
Below is the code from Firs. It currently generates a string name of "Town" + "Manor"
nearby_station_name: string(STR_STATION, string(STR_TOWN), string(STR_STATION_FARM));
I want to have the possibility of selecting string(STR_STATION_FARM) or string(STR_STATION_FARM1) and so on possibly up to FARM6 (or some range of strings I've added to the lang file) but I can't quite work out how to do this so that any of the 6-7 possibilities can be randomly selected. I'm suspecting that I need to use SWITCH to return one of the FARMx strings but I don't know how to tie it all together.
Any suggestions?
Thanks in advance.
Setting station names from nearby industries
Moderator: Graphics Moderators
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Setting station names from nearby industries
nearby_station_name is only available as property. Thus you can give it one value but not more.3iff wrote: nearby_station_name: string(STR_STATION, string(STR_TOWN), string(STR_STATION_FARM));
In order to apply a switch nearby_station_name would need be become available (also) as callback - which currently it is not; that will need an extension of the grf specs / additional code in OpenTTD. Beware there might be dragons lurking in the station names;): the callback, once called for a station, must at all times and under all circumstances return the same value henceforth - a thing which would need to be enforced on the OpenTTD side instead of NewGRF side or we get yet another desync issue; which might be circumvented if the station name is stored as custom station name as a station property.
EDIT: alternatively the propertycould become a list of strings (in grf v9, or another property in grf <v9) and the industry assigned upon creation a random number which gives the actual string to be used.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Setting station names from nearby industries
I think I understand, so I'm limited to one fixed (custom) name per industry. That's slightly disappointing but I can live with that.
Thanks.
Thanks.
Who is online
Users browsing this forum: No registered users and 23 guests