How to make vehicles compatible with and without a NRT set

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

Moderator: Graphics Moderators

Post Reply
User avatar
LaDoncella
Traffic Manager
Traffic Manager
Posts: 249
Joined: 28 Sep 2004 16:01
Contact:

How to make vehicles compatible with and without a NRT set

Post by LaDoncella »

I was updating the eGRVT2 code to handle NotRoadTypes along something else.
And noticed that when you give a tram the tram_type: RAIL code, it will work as expected with a NRT set. But without it (the NRT set) the tram in question will not be available for purchase.

What would be the best way to handle this?
User avatar
LaDoncella
Traffic Manager
Traffic Manager
Posts: 249
Joined: 28 Sep 2004 16:01
Contact:

Re: How to make vehicles compatible with and without a NRT set

Post by LaDoncella »

Well, I solved this by creating a simple RAIL and ELRL tramtypes that can be disabled with a parameter.

Code: Select all

	param 2 {
		enable_tramtypes_tracks {
			name: string(STR_PARAM_ENABLE_TRAMTYPE_TRACK);
			desc: string(STR_PARAM_ENABLE_TRAMTYPE_TRACK_DESC);
			type: bool;
			bit:  0;
			def_value: 1;
		}
	}

tramtypetable {
	RAIL,
	ELRL	
}
if (enable_tramtypes_tracks == 1)
{
	item(FEAT_TRAMTYPES, item_basic_tramtrack, 13) {
		property {
			label:                       "RAIL";
			introduction_date:           0;
			name:                        string(STR_TRAM_TRACK_NAME);
			toolbar_caption:             string(STR_TRAM_TRACK_TOOLBAR);
			menu_text:                   string(STR_TRAM_TRACK_MENU);
			build_window_caption:        string(STR_TRAM_BUILD_VEHICLE);
			autoreplace_text:            string(STR_TRAM_AUTOREPLACE);
			new_engine_text:             string(STR_TRAM_NEW_ENGINE);
			powered_tramtype_list:       ["RAIL", "ELRL"];
	//		tramtype_flags:              bitmask(TRAMTYPE_FLAG_CATENARY);
			construction_cost:           8; //Defaults: ROAD = 8, ELRD = 16, RAIL = 8, ELRL = 16
			maintenance_cost:            16; //Defaults: ROAD = 16, ELRD = 24, RAIL = 16, ELRL = 24		
			sort_order:                  00;		
		}
	}

	item(FEAT_TRAMTYPES, item_electric_tramtrack, 14) {
		property {
			label:                       "ELRL";
			introduction_date:           0;
			name:                        string(STR_ELECTRIC_TRAM_TRACK_NAME);
			toolbar_caption:             string(STR_ELECTRIC_TRAM_TRACK_TOOLBAR);
			menu_text:                   string(STR_ELECTRIC_TRAM_TRACK_MENU);
			build_window_caption:        string(STR_TRAM_BUILD_VEHICLE);
			autoreplace_text:            string(STR_TRAM_AUTOREPLACE);
			new_engine_text:             string(STR_TRAM_NEW_ENGINE);
			powered_tramtype_list:       ["ELRL"];
			tramtype_flags:              bitmask(TRAMTYPE_FLAG_CATENARY);
			construction_cost:           16; //Defaults: ROAD = 8, ELRD = 16, RAIL = 8, ELRL = 16
			maintenance_cost:            24; //Defaults: ROAD = 16, ELRD = 24, RAIL = 16, ELRL = 24		
			sort_order:                  01;		
		}
	}
}
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

Re: How to make vehicles compatible with and without a NRT set

Post by Wahazar »

You can make own non-electrified tram track very easy, without any additional graphics - it is just standard tram track without catenary.
Here is code similar to these used in RattRoads:

Code: Select all

item(FEAT_TRAMTYPES, item_basic_tramtrack, 13) {
	property {
		label:                       "RAIL";
		introduction_date:           1860;
		name:                        string(STR_TRAM_TRACK_NAME);
		toolbar_caption:             string(STR_TRAM_TRACK_TOOLBAR);
		menu_text:                   string(STR_TRAM_TRACK_MENU);
		build_window_caption:        string(STR_TRAM_BUILD_VEHICLE);
		autoreplace_text:            string(STR_TRAM_AUTOREPLACE);
		new_engine_text:             string(STR_TRAM_NEW_ENGINE);
		powered_tramtype_list:       ["RAIL", "ELRL"];
//		tramtype_flags:              bitmask(TRAMTYPE_FLAG_CATENARY);
		construction_cost:           8; //Defaults: ROAD = 8, ELRD = 16, RAIL = 8, ELRL = 16
		maintenance_cost:            16; //Defaults: ROAD = 16, ELRD = 24, RAIL = 16, ELRL = 24		
//		speed_limit:                 85 mph;
		sort_order:                  00;		
	}
}
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 4 guests