engine_override grf

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

Moderator: Graphics Moderators

Post Reply
Eddy Arfik
Transport Coordinator
Transport Coordinator
Posts: 260
Joined: 09 Apr 2014 11:10

engine_override grf

Post by Eddy Arfik »

I'm trying to make a grf using the engine_override command to adjust capacity of wagons in another trainset, and having some trouble. When I use the code below, it only adjusts default capacity, refits are not changed

Code: Select all

item (FEAT_TRAINS, goods_van, 0x25)
	{
		property
		{
			cargo_capacity: 60;
			refittable_cargo_classes: bitmask(CC_EXPRESS, CC_PIECE_GOODS);
		}
	}
When I use this code, it adjusts all capacities correct, but the wagon changes to base-set graphics

Code: Select all

switch (FEAT_TRAINS, SELF, goods_wagon_capacity_switch, cargo_type_in_veh) 
	{
    return 60;
	}

item (FEAT_TRAINS, goods_wagon, 0x25) 
	{
		property 
		{
		cargo_capacity: 60;
		}
		graphics
		{
        cargo_capacity:     goods_wagon_capacity_switch;
		}
	}
Is there any way I can use the callback to change capacity while still using the sprites from the target grf?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: engine_override grf

Post by planetmaker »

Define the NewGRF by ID which you want to override: http://newgrf-specs.tt-wiki.net/wiki/NM ... er_NewGRFs . Then you need to know the IDs of the vehicles used in the set you want to override and re-define those properties you're interested in changing.
EDIT: but if you plan on changing callbacks, you need to re-define *all* callbacks of that vehicle. You cannot simply add one.
Eddy Arfik
Transport Coordinator
Transport Coordinator
Posts: 260
Joined: 09 Apr 2014 11:10

Re: engine_override grf

Post by Eddy Arfik »

I already know the ID's, and the overrides are working correctly for normal properties such as power, weight etc... It's only when I try to set a property using a callback that I lose the graphics defined by the target grf.
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 991
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: engine_override grf

Post by frosch »

You are correct. There is no way to change a callback while keeping the graphics. The action 3 is replaced as a whole only.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 15 guests