[NML] powered_railtype_list not working properly

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

Moderator: Graphics Moderators

Post Reply
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

[NML] powered_railtype_list not working properly

Post by Erato »

I'm currently working on a maglev track set and I want it to be possible to use this set with other vehicle sets, or with the standard game.
This is the code for one of the maglev tracks:

Code: Select all

spriteset (LCAE_underlay, "grf/LCAE.png") {
	tmpl_underlay_track_types()
}
spriteset (LCAE_overlay, "grf/LCAE.png") {
	tmpl_overlay_track_types()
}
spriteset (LCAE_bridge, "grf/LCAE.png") {
	tmpl_bridges_overlay()
}
spriteset (LCAE_tunnel, "grf/LCAE.png") {
	tmpl_tunnel_tracks()
}
spriteset (LCAE_depot, "grf/LCAE_Depot.png") {
	tmpl_depot()
}

//Chuo Shinkansen Maglev Track
item(FEAT_RAILTYPES, T_CHUOSHINKANSEN, 15) {
     property {
         label:                      "LCAE";
         name:                       string(STR_LCAE);
         menu_text:                  string(STR_LCAE);
         build_window_caption:       string(STR_LCAE_BUILD_CAPTION);
         autoreplace_text:           string(STR_LCAE_AUTOREPLACE);
         new_engine_text:            string(STR_LCAE_NEW_ENGINE);
		 toolbar_caption:			 string(STR_LCAE_TB_CAPTION);
         compatible_railtype_list:   ["MGLV", LXXE];
         powered_railtype_list:      ["MGLV", LXXE];
         railtype_flags:             bitmask(RAILTYPE_FLAG_NO_LEVEL_CROSSING);
		 introduction_date:			 date(1972,1,1);
         curve_speed_multiplier:     1;
         station_graphics:           RAILTYPE_STATION_MAGLEV;                  
         construction_cost:          24;                                     
         speed_limit:                610 km/h;
         acceleration_model:         ACC_MODEL_MAGLEV;         
		 maintenance_cost:		     12;			
     }
     graphics {
         track_overlay:		LCAE_overlay;				// defines the sprites drawn as overlay for junctions and highlight
         underlay:			LCAE_underlay;				// defines the usual tracks and the underlay for junctions
         bridge_surfaces:	LCAE_bridge;				// defines the overlay drawn over bridges
		 tunnels:			LCAE_tunnel;				// defines the tracks drawn on a funnel tile
         depots:            LCAE_depot;    				// defines the depot sprites
		 
         //fences:          fences_set;                // defines the look of fences
		 
         //level_crossings: level_crossing_switch;     // No crossing maglev rail => no level crossing
     }
 }
With LXXE being thusly defined:

Code: Select all

#define LXXE \
	"LAAE", "LABE", "LACE", "LADE", "LAEE", \
	"LBAE", "LBBE", "LBCE", "LBDE", "LBEE", \
	"LCAE", "LCBE", "LCCE", "LCDE", "LCEE" 
But unless I have a newGRF with compatible vehicles, the Depot menu is completely empty and shows nothing.
IIRC "powered_railtype_list" would allow any vehicle marked as whatever comes after that tag to be available in the depot. In this case that would mean that if you only have this track set installed, all stock vehicles should be available in the depot, but they're not. Am I missing something?
No pics no clicks. Seriously.
ImageImageImageImageImageImage
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [NML] powered_railtype_list not working properly

Post by Leanden »

When you say all stock vehicles, youve only defined the MGLV and not RAIL or ELRL, so do you mean only stock Maglevs?

In which case are you starting your test game in a late enough year and have Vehicles Never Expire set to trie?
Image
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: [NML] powered_railtype_list not working properly

Post by Erato »

Leanden wrote:When you say all stock vehicles, youve only defined the MGLV and not RAIL or ELRL, so do you mean only stock Maglevs?

In which case are you starting your test game in a late enough year and have Vehicles Never Expire set to trie?
Yes, only stock MGLV vehicles.
I started the test game in 19.700 with vehicles never expire.
No pics no clicks. Seriously.
ImageImageImageImageImageImage
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [NML] powered_railtype_list not working properly

Post by Leanden »

Is that 1979 or 19,700?

19700 seems like a really odd start date and im sure would cause all kinds of overflow issues.

If its 1979 the stock maglev vehicles wont be available yet. Try 2030 as a start date :)
Image
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: [NML] powered_railtype_list not working properly

Post by Alberth »

Leanden wrote:19700 seems like a really odd start date and im sure would cause all kinds of overflow issues.
Nah, you can play until around the year 5,000,000. Unfortunately, you don't live long enough to reach that year without fast-forwarding or skipping years by picking another game-date.

2030 should work too, the first maglev ( https://wiki.openttd.org/Lev1_%27Leviathan%27 ) arrives around 2021.
Being a retired OpenTTD developer does not mean I know what I am doing.
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: [NML] powered_railtype_list not working properly

Post by Erato »

Leanden wrote:Is that 1979 or 19,700?

19700 seems like a really odd start date and im sure would cause all kinds of overflow issues.

If its 1979 the stock maglev vehicles wont be available yet. Try 2030 as a start date :)
Nineteen thousand seven hundred.
Thing is, the stock maglev rail depot does have the stock trains. I will try 2030 in a bit, but I don't think that's it, because the trains are available.
EDIT: Started a world in 2000 and worked my way up. This is 2022: Image
No pics no clicks. Seriously.
ImageImageImageImageImageImage
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: [NML] powered_railtype_list not working properly

Post by Transportman »

Try to also set the powered_railtype_list and compatible_railtype_list of the MGLV railtype. Now MGLV does not know about your railtypes, while that is what you want.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: [NML] powered_railtype_list not working properly

Post by Erato »

Transportman wrote:Try to also set the powered_railtype_list and compatible_railtype_list of the MGLV railtype. Now MGLV does not know about your railtypes, while that is what you want.
How would I go about changing specs of a stock track? I've never done such a thing before so I wouldn't know.
No pics no clicks. Seriously.
ImageImageImageImageImageImage
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: [NML] powered_railtype_list not working properly

Post by Transportman »

Erato wrote:
Transportman wrote:Try to also set the powered_railtype_list and compatible_railtype_list of the MGLV railtype. Now MGLV does not know about your railtypes, while that is what you want.
How would I go about changing specs of a stock track? I've never done such a thing before so I wouldn't know.
The same way you would go around to creating a new track type, but instead of using an own railtype label, you use the stock track label (MGLV in this case).
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: [NML] powered_railtype_list not working properly

Post by Erato »

Transportman wrote:
Erato wrote:
Transportman wrote:Try to also set the powered_railtype_list and compatible_railtype_list of the MGLV railtype. Now MGLV does not know about your railtypes, while that is what you want.
How would I go about changing specs of a stock track? I've never done such a thing before so I wouldn't know.
The same way you would go around to creating a new track type, but instead of using an own railtype label, you use the stock track label (MGLV in this case).
Nice! Thanks! This completely solved my problem.
For the interested:

Code: Select all

//Stock Maglev Track
item(FEAT_RAILTYPES, MGLV) {
     property {
         label:                      "MGLV";
         compatible_railtype_list:   [LXXN, LXXE, LXXT, LXX3];
         powered_railtype_list:      [LXXN, LXXE, LXXT, LXX3];
     }
 }
No pics no clicks. Seriously.
ImageImageImageImageImageImage
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 3 guests