Make parameter requirement

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

Make parameter requirement

Post by Erato »

So, after getting Make to work, I keep getting the following crash whenever I use the "make" command:

Code: Select all

[Knmlc ERROR: "src/switch.pnml", line 4: Switch-block requires 4 parameters, encountered 3
So, I checked switch.pnml, and it indeed had 3 parameters; I had derped. I had this:

Code: Select all

switch (FEAT_TRAINS, PARENT, CAN_ATTACH) {
	ITEM_HSST03		:string(STR_CANNOT_CONNECT);
	ITEM_MBAHN		:string(STR_CANNOT_CONNECT);
	ITEM_HSST100L	:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_HSST100S	:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_TRANSRAPID	:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_LINIMO		:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_UTM02		:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
//	ITEM_WINDCHASER	:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_ECOBEE		:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_CHANGSHA	:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_S1			:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_L0			:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	string(STR_CANNOT_CONNECT);
}
After fixing the problem and adding the 4th parameter:

Code: Select all

switch (FEAT_TRAINS, PARENT, CAN_ATTACH, vehicle_type_id) {
	ITEM_HSST03		:string(STR_CANNOT_CONNECT);
	ITEM_MBAHN		:string(STR_CANNOT_CONNECT);
	ITEM_HSST100L	:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_HSST100S	:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_TRANSRAPID	:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_LINIMO		:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_UTM02		:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
//	ITEM_WINDCHASER	:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_ECOBEE		:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_CHANGSHA	:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_S1			:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	ITEM_L0			:CB_RESULT_ATTACH_ALLOW_IF_RAILTYPES;
	string(STR_CANNOT_CONNECT);
}
The crash kept occurring. Am I doing something horribly wrong?
No pics no clicks. Seriously.
ImageImageImageImageImageImage
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: Make parameter requirement

Post by Sylf »

Erato wrote:The crash kept occurring.
What was the exact error message after you made that change? I suspect it wasn't exactly the same as before.
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Make parameter requirement

Post by Erato »

Sylf wrote:
Erato wrote:The crash kept occurring.
What was the exact error message after you made that change? I suspect it wasn't exactly the same as before.
That's the problem, it was.
No pics no clicks. Seriously.
ImageImageImageImageImageImage
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: Make parameter requirement

Post by Leanden »

Just a hunch but i suspect that despite the error, the make file still compiled a complete nml file anyway in the main directory of your working folder, in which case it would default to that nml file which already has the error written into it, might i suggest removing any NML files that werent there before and running make again.

Also potentially a silly question, but did you save changes to switch.pnml before you tried to compile it again?
Image
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Make parameter requirement

Post by planetmaker »

That first switch doesn't follow the expected syntax concerning parameters...
http://newgrf-specs.tt-wiki.net/wiki/NML:Switch

Are you sure you actually tried to compile the corrected one as you quote in the 2nd one (e.g. that the makefile correctly updated the nml which actually is treated by nml)?
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Make parameter requirement

Post by Erato »

Leanden wrote:Just a hunch but i suspect that despite the error, the make file still compiled a complete nml file anyway in the main directory of your working folder, in which case it would default to that nml file which already has the error written into it, might i suggest removing any NML files that werent there before and running make again.
Ah yes, this fixed the problem.
Thanks!
No pics no clicks. Seriously.
ImageImageImageImageImageImage
Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

Re: Make parameter requirement

Post by Eddi »

Erato wrote:
Leanden wrote:Just a hunch but i suspect that despite the error, the make file still compiled a complete nml file anyway in the main directory of your working folder, in which case it would default to that nml file which already has the error written into it, might i suggest removing any NML files that werent there before and running make again.
Ah yes, this fixed the problem.
Thanks!
you're missing some dependencies in your makefile (the .nml file must depend on every .pnml file, these usually need to be listed manually, or generated into a .src.dep file)

in any case, "make -B" will ignore dependencies and make a full compile.
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: Make parameter requirement

Post by Leanden »

Eddi ive had this issue where my makefile isnt picking up my pnml files, ive had to manually gcc them into nml first, will this resolve that issue.

I.e. Make -B
Image
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 6 guests