The graphics I'm using don't fit into any of the standard templates from the tutorial I'm using, so I've managed to point to some non-existent coordinates, with NML giving me this:
Code: Select all
ERROR: "BR_415.nml", line 23: Read beyond bounds of image file 'gfx/Network_SouthEast_ BR_Class_415.png'
Included from: "BR_415.nml", line 32
Included from: "BR_415.nml", line 51
Included from: "BR_415.nml", line 51
- [+] Spoiler
Code: Select all
/* Define grf */ grf { grfid: "MBG\01"; /* GRF name and description strings are defined in the lang files */ name: string(STR_GRF_NAME); desc: string(STR_GRF_DESC); /* This is the first version, start numbering at 0. */ version: 0; min_compatible_version: 0; } /* Define a rail type table, * this allows referring to railtypes * irrespective of the grfs loaded. */ railtypetable { RAIL, ELRL, MONO, MGLV, } /* Basic template for 4 vehicle views */ template tmpl_vehicle_basic(x, y) { // arguments x, y: coordinates of top-left corner of first sprite [x, y, 8, 24, -3, -12] //xpos ypos xsize ysize xrel yrel [x + 9, y, 26, 22, -14, -12] [x + 37, y, 32, 13, -16, -12] [x + 71, y, 26, 22, -6, -12] } /* Template for a vehicle with only 4 views (symmetric) */ template tmpl_vehicle_4_views(num) { // argument num: Index in the graphics file, assuming vertical ordering of vehicles tmpl_vehicle_basic(1, 1 + 26 * num) } /* Template for a vehicle with 8 views (non-symmetric) */ template tmpl_vehicle_8_views(num, reversed) { // argument num: Index in the graphics file, assuming vertical ordering of vehicles // argument reversed: Reverse visible orientation of vehicle, if set to 1 tmpl_vehicle_basic(reversed ? 100 : 1, 1 + 26 * num) tmpl_vehicle_basic(reversed ? 1 : 100, 1 + 26 * num) } /* Template for a single vehicle sprite */ template tmpl_vehicle_single(num, xsize, ysize, xoff, yoff) { [1, 1 + 26 * num, xsize, ysize, xoff, yoff] } /* Define the spritesets, these allow referring to these sprites later on */ spriteset (set_br415_nse_front, "gfx/Network_SouthEast_ BR_Class_415.png") { tmpl_vehicle_8_views(0, 0) } spriteset (set_br415_nse_rear, "gfx/Network_SouthEast_ BR_Class_415.png") { tmpl_vehicle_8_views(1, 1) } spriteset (set_br415_nse_middle_1, "gfx/Network_SouthEast_ BR_Class_415.png") { tmpl_vehicle_4_views(4) } spriteset (set_br415_nse_middle_2, "gfx/Network_SouthEast_ BR_Class_415.png") { tmpl_vehicle_4_views(4) } spriteset (set_br415_nse_invisible, "gfx/Network_SouthEast_ BR_Class_415.png") { tmpl_vehicle_single(6, 1, 1, 0, 0) } /* Choose between front, middle and back parts */ switch(FEAT_TRAINS, SELF, sw_br415_nse_graphics, position_in_consist % 4) { 0: set_br415_nse_front; 1: set_br415_nse_middle_1; 2: set_br415_nse_middle_2; 3: set_br415_nse_rear; } /* --- Articulated part callback --- */ switch(FEAT_TRAINS, SELF, sw_br415_nse_articulated_part, extra_callback_info1) { /* Add three articulated parts, for a total of four */ 1 .. 3: return item_br415_nse; return CB_RESULT_NO_MORE_ARTICULATED_PARTS; } /* --- Start/stop callback --- */ switch(FEAT_TRAINS, SELF, sw_br415_nse_start_stop, num_vehs_in_consist) { /* Vehicles may be coupled to a maximum of 2 units (8 cars) */ 1 .. 8: return CB_RESULT_NO_TEXT; return string(STR_BR415_NSE_CANNOT_START); } /* --- Wagon attach callback --- */ switch(FEAT_TRAINS, SELF, sw_br415_nse_can_attach_wagon, vehicle_type_id) { /* SELF refers to the wagon here, check that it's a 415 */ item_br415_nse: return CB_RESULT_ATTACH_ALLOW; return string(STR_BR415_NSE_CANNOT_ATTACH_OTHER); } /* Define the actual train */ item(FEAT_TRAINS, item_br415_nse) { /* Define properties first, make sure to set all of them */ property { name: string(STR_BR415_NSE_NAME); // not available in toyland: climates_available: bitmask(CLIMATE_TEMPERATE, CLIMATE_ARCTIC, CLIMATE_TROPICAL); introduction_date: date(1951, 1, 1); model_life: VEHICLE_NEVER_EXPIRES; vehicle_life: 30; reliability_decay: 20; refittable_cargo_classes: bitmask(CC_PASSENGERS); non_refittable_cargo_classes: bitmask(); // refitting is done via cargo classes only, no cargo types need explicit enabling/disabling loading_speed: 8; cost_factor: 45; running_cost_factor: 100; sprite_id: SPRITE_ID_NEW_TRAIN; speed: 121 km/h; misc_flags: bitmask(TRAIN_FLAG_MU); refit_cost: 0; //refit costs don't apply to subcargo display // callback flags are not set manually track_type: ELRL; // from rail type table ai_special_flag: AI_FLAG_PASSENGER; power: 750 kW; running_cost_base: RUNNING_COST_ELECTRIC; dual_headed: 0; cargo_capacity: 98; weight: 60 ton; ai_engine_rank: 0; // not intended to be used by the ai engine_class: ENGINE_CLASS_ELECTRIC; extra_power_per_wagon: 0 kW; // 4/12 of weight on driving wheels, with a default friction coefficient of 0.3: tractive_effort_coefficient: 0.3 / 3; air_drag_coefficient: 0.06; visual_effect_and_powered: VISUAL_EFFECT_DISABLE; extra_weight_per_wagon: 0 ton; bitmask_vehicle_info: 0; } /* Define graphics and callbacks * Setting all callbacks is not needed, only define what is used */ graphics { default: sw_br415_nse_graphics; start_stop: sw_br415_nse_start_stop; articulated_part: sw_br415_nse_articulated_part; can_attach_wagon: sw_br415_nse_can_attach_wagon; } }