Rail Type Introduction & its relationship to Introduction Date

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

Moderator: Graphics Moderators

Post Reply
User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 696
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Rail Type Introduction & its relationship to Introduction Date

Post by Gwyd » 13 Jul 2019 20:02

So I was playing around with making some of my own railtypes, and to make some railtypes that were required from a technical standpoint but should not available to the player (let's call it railtype X), I set the property "introduction_date" of the tracktype to the year 5000000, the quoted maximum from: https://newgrf-specs.tt-wiki.net/wiki/NML:Railtypes.

When I compiled this into a NewGRF regardless of the date, once the first train for railtype X was made available (~1980) railtype X was made available.

Some more digging on that same page tells me that the game will basically ignore the "introduction_date" property, unless no trains are explicitly allowed on it. To me this seem unintuitive and unhelpful. Yes, I am pushing the limits of the design for a specific use case, but nonetheless this implication does not appear to be the best possible.

Eddi
Tycoon
Tycoon
Posts: 7412
Joined: 17 Jan 2007 00:14

Re: Rail Type Introduction & its relationship to Introduction Date

Post by Eddi » 14 Jul 2019 00:55

with openttd 1.9 was added the ability to hide railtypes from the construction menu. that sounds like what you're looking for here. (property 10 bit 2)
You might not exactly be interested in Ferion, but if you are, have fun :)

User avatar
Erato
Route Supervisor
Route Supervisor
Posts: 405
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Rail Type Introduction & its relationship to Introduction Date

Post by Erato » 14 Jul 2019 12:29

Eddi wrote:
14 Jul 2019 00:55
with openttd 1.9 was added the ability to hide railtypes from the construction menu. that sounds like what you're looking for here. (property 10 bit 2)
Is there a way to implement this using NML?
No pics no clicks. Seriously. Also stop using Modern Maglev Trains. Use RIMS instead.
ImageImageImageImageImageImage

Eddi
Tycoon
Tycoon
Posts: 7412
Joined: 17 Jan 2007 00:14

Re: Rail Type Introduction & its relationship to Introduction Date

Post by Eddi » 15 Jul 2019 01:12

yes, property 10 is called "railtype_flags" there. i imagine it hasn't got a name for the bit, though, so you'd have to use the raw number, like

Code: Select all

bitmask(2)
You might not exactly be interested in Ferion, but if you are, have fun :)

User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 696
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: Rail Type Introduction & its relationship to Introduction Date

Post by Gwyd » 15 Jul 2019 07:48

I tried to do something like that after reading the nfo specs about it, but I couldn't seem to get the desired result.

Eddi
Tycoon
Tycoon
Posts: 7412
Joined: 17 Jan 2007 00:14

Re: Rail Type Introduction & its relationship to Introduction Date

Post by Eddi » 15 Jul 2019 14:46

i'm afraid you need to provide us with more details
You might not exactly be interested in Ferion, but if you are, have fun :)

User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 696
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: Rail Type Introduction & its relationship to Introduction Date

Post by Gwyd » 16 Jul 2019 22:18

What I'm trying to ask is how would I set flags in the item block of some item which doesn't have a name implemented into NML like RAILTYPE_FLAG_CATENARY, but rather one that is defined under property 10 for NFO.
In this particular case, I want to set the railtype to have the "hidden in construction menu" flag enabled, which in NFO is defined as bit 2 with a value of 4 in property 10. I have attempted this in NML by trying the code

Code: Select all

bitmask(4)
In the item block of the railtype in question, but this didn't seem to work.
This suggests either:
I wasn't being rigorous in testing the change
or I'm doing it wrong.


EDIT: I just had to copy Eddi's post to hide the track type, thank you for your help. Still unsure on the behaviour of railtype releases.

Transportman
Tycoon
Tycoon
Posts: 2687
Joined: 22 Feb 2011 18:34

Re: Rail Type Introduction & its relationship to Introduction Date

Post by Transportman » 17 Jul 2019 18:37

Gwyd wrote:
16 Jul 2019 22:18
What I'm trying to ask is how would I set flags in the item block of some item which doesn't have a name implemented into NML like RAILTYPE_FLAG_CATENARY, but rather one that is defined under property 10 for NFO.
In this particular case, I want to set the railtype to have the "hidden in construction menu" flag enabled, which in NFO is defined as bit 2 with a value of 4 in property 10. I have attempted this in NML by trying the code

Code: Select all

bitmask(4)
In the item block of the railtype in question, but this didn't seem to work.
This suggests either:
I wasn't being rigorous in testing the change
or I'm doing it wrong.


EDIT: I just had to copy Eddi's post to hide the track type, thank you for your help. Still unsure on the behaviour of railtype releases.
It didn't work because you misunderstood how the bitmask() function works, it sets the bit at the position you provide. So if you need to set a property to value 4, you can do that by setting bit 2 (1x2^n, where n is the bit you set, in this case 2).

I think the railtype release behavior is a bit of a safeguard against several things (vehicle introduction dates randomization, different vehicle and track NewGRFs), so the safe behavior is to forcefully introduce the railtype when a vehicle becomes available for it. But there are cases where a railtype should not become available as it is a technical type, which is now covered with the "hidden in construction menu" flag.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML

Eddi
Tycoon
Tycoon
Posts: 7412
Joined: 17 Jan 2007 00:14

Re: Rail Type Introduction & its relationship to Introduction Date

Post by Eddi » 18 Jul 2019 00:39

Gwyd wrote:
16 Jul 2019 22:18
which in NFO is defined as bit 2 with a value of 4
this is the important information. if you use the "bitmask" function, you need to use the bit number (2), if you don't use the bitmask function, you can use the value (4). in other words, bitmask(2) == 4
You might not exactly be interested in Ferion, but if you are, have fun :)

Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest