Page 1 of 1

[NML] powered_railtype_list not working properly

Posted: 11 Jun 2017 22:07
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?

Re: [NML] powered_railtype_list not working properly

Posted: 12 Jun 2017 00:48
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?

Re: [NML] powered_railtype_list not working properly

Posted: 12 Jun 2017 06:19
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.

Re: [NML] powered_railtype_list not working properly

Posted: 12 Jun 2017 07:18
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 :)

Re: [NML] powered_railtype_list not working properly

Posted: 12 Jun 2017 10:22
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.

Re: [NML] powered_railtype_list not working properly

Posted: 12 Jun 2017 11:14
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

Re: [NML] powered_railtype_list not working properly

Posted: 12 Jun 2017 17:07
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.

Re: [NML] powered_railtype_list not working properly

Posted: 12 Jun 2017 17:12
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.

Re: [NML] powered_railtype_list not working properly

Posted: 13 Jun 2017 16:21
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).

Re: [NML] powered_railtype_list not working properly

Posted: 13 Jun 2017 17:53
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];
     }
 }