Page 1 of 1

Make parameter requirement

Posted: 01 May 2016 20:38
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?

Re: Make parameter requirement

Posted: 02 May 2016 04:49
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.

Re: Make parameter requirement

Posted: 02 May 2016 08:15
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.

Re: Make parameter requirement

Posted: 02 May 2016 08:42
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?

Re: Make parameter requirement

Posted: 02 May 2016 09:00
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)?

Re: Make parameter requirement

Posted: 02 May 2016 13:47
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!

Re: Make parameter requirement

Posted: 03 May 2016 12:35
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.

Re: Make parameter requirement

Posted: 03 May 2016 15:33
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