Hargs' Articulation Woes

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

Moderator: Graphics Moderators

User avatar
hargs
Traffic Manager
Traffic Manager
Posts: 129
Joined: 13 Feb 2012 23:19
Location: Manchester. UK.

Hargs' Articulation Woes

Post by hargs »

I've been trying to do some articulated recently but seem to hit a wall in terms of what I can work out, which is probably a given when you try smush bits of code together you don't really understand.

The code seems to work quite well for 8 car trains but beyound that things start to go wrong, illustrated in this screenshot.
articulation errors.png
articulation errors.png (73.77 KiB) Viewed 4772 times
I think the answer, (or lack there of) is somewhere in this bit of code.

Code: Select all

//
//choose sprites depending on position (D1)
  486 * 30	 02 00 90 81 40 00 0C 05
			02 00 09 0B // 10th to 11th coach
			03 00 08 08 // 5th car Second Panto
			02 00 04 07	// 5th to 8th coach
			04 00 03 03	// 3th car First Panto
			02 00 01 02	// 2nd to 3rd coach
			00 00		// 1st car Front
//
//check if at last vehicle (D1)
  487 * 17	 02 00 84 85 40 00 00 FF 01 01 00 00 00 00 00 90 00
//check if first vehicle (D1)
  488 * 14	 02 00 82 81 40 00 FF 01 00 00 00 00 84 00
//choose sprites depending on position (D0)
  489 * 30	 02 00 70 81 40 00 0C 05
			02 00 09 0B // 10th to 11th coach
			03 00 08 08 // 5th car Second Panto
			02 00 04 07	// 5th to 8th coach
			04 00 03 03	// 3th car First Panto
			02 00 01 02	// 2nd to 3rd coach
			00 00		// 1st car Front
////check if at last vehicle (D0)
  490 * 17	 02 00 64 85 40 00 00 FF 01 01 00 00 00 00 00 70 00
//
//check if first vehicle (D0)
  491 * 14	 02 00 62 81 40 00 FF 01 00 00 00 00 64 00
//check direction (D0 or D1):
  492 * 14	 02 00 60 82 FF 00 01 01 62 00 00 00 82 00
// 
// set CB 16 (articulated vehicle)
//!!Warning (94): Redefining ID 05 not used since previous definition at sprite 484.
  493 * 14	 02 00 05 81 10 00 FF 01
			7F 80 01 0B	// 11 additional parts of veh-ID 7F (base articulated car)
			FF 80		// end articulated vehicle		

// set CB 1D (engine attach)
// allow only 1 * EMU (= 12 cars) in total
//!!Warning (94): Redefining ID 06 not used since previous definition at sprite 485.
  494 * 14	 02 00 06 82 40 10 FF 01
			FE 80 00 0C	// allow adding of max 12 cars
			20 80		// error: "wrong number of cars" 

// allow only S seris to, nothing else
  495 * 18	 02 00 07 81 C6 00 FF 02
			06 00 FA FA
			06 00 7F 7F
			50 80		// error: "wrong type of car"
//process callback 10 (powered wagon) for direction 1
  496 * 18	 02 00 54 81 40 08 07 02
			38 80 03 03
			38 80 08 08
			40 80

//process callback 10 (powered wagon) for direction 0
  497 * 18	 02 00 53 81 40 00 07 02
			34 80 03 03
			34 80 08 08
			40 80
//check direction for callback 10:
  498 * 14	 02 00 52 82 FF 00 01 01 53 00 00 00 54 00	
//
//begin wagon chain: check for CB 10 (powered wagon)
  499 * 14	 02 00 50 81 0C 00 FF 01
			52 00 10 10
			60 00
// switch between callback and graphics branch
  500 * 23	 02 00 09 85 0C 00 FF FF 02
			05 00 16 00 16 00	// is CB 16, handle it
			07 00 1D 00 1D 00	// is CB 1D, handle it
			50 00		// graphics
Any help would be very greatly appreciated.

ps. apologies if this just me being stupid.
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Hargs' Articulation Woes

Post by michael blunck »

Your code seems needlessly complicated:

- sprites #70 and #90 are identical. Why?
- why needs #84 be WORD-sized, but #82 BYTE-sized?
- likewise #62 and #64?
- I understand that direction of travel seems to be important for CB10 (sparking), but not for the graphics?
- "check if last vehicle" and "check if first vehicle" are both checking for the first vehicle (8x 40 00), either this is an improper comment or a bug?
- you could include #50 into #9 by making the check for CB10 also WORD-sized. OTOH, all those CB checks in #9 could be as well BYTE-sized ...

regards
Michael
Image
User avatar
hargs
Traffic Manager
Traffic Manager
Posts: 129
Joined: 13 Feb 2012 23:19
Location: Manchester. UK.

Re: Hargs' Articulation Woes

Post by hargs »

Hmm well it seems I lack too many of the fundamental skills to do this, I didn't even know you could do things like changing WORD- sized to BYTE-sized.

Still I appreciate the effort all the same.
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Hargs' Articulation Woes

Post by michael blunck »

hargs wrote: Hmm well it seems I lack too many of the fundamental skills to do this,
Well, most of your code makes sense.

OTOH, I don´t really understand why it looks so "complicated". I.e., in the graphics chain:

- why do you explicitly check if the train runs forward or backward?
- why do you explicitly check for the first and the last vehicle? I mean, you´re doing it again (by default) in #70 and (duplicate!) in #90.
hargs wrote: I didn't even know you could do things like changing WORD- sized to BYTE-sized.
This one is checking for callbacks WORD-sized:

> 02 00 09 85 0C 00 FF FF ...

And this does the same BYTE-sized

> 02 00 50 81 0C 00 FF ...
hargs wrote: Still I appreciate the effort all the same.
Unifying the code would make it more readable.

I.e., instead of

Code: Select all

//begin wagon chain: check for CB 10 (powered wagon)
  499 * 14    02 00 50 81 0C 00 FF 01
         52 00 10 10
         60 00
// switch between callback and graphics branch
  500 * 23    02 00 09 85 0C 00 FF FF 02
         05 00 16 00 16 00   // is CB 16, handle it
         07 00 1D 00 1D 00   // is CB 1D, handle it
         50 00       // graphics
You could simply write

Code: Select all

// switch between callback and graphics branch
  500 * 23    02 00 09 81 0C 00 FF 03
         52 00 10 10 // is CB 10, handle it
         05 00 16 16 // is CB 16, handle it
         07 00 1D 1D // is CB 1D, handle it
         60 00       // graphics
Other than this, it´s quite similar to my ICE-3. I could post the code if you want to.

regards
Michael
Image
User avatar
hargs
Traffic Manager
Traffic Manager
Posts: 129
Joined: 13 Feb 2012 23:19
Location: Manchester. UK.

Re: Hargs' Articulation Woes

Post by hargs »

Well I've to simplify it as best I could, though I might have just made it worse.

I'm now getting this, which looks as if something is causing it to reset the order at car 04.
articulation errors2.png
articulation errors2.png (8.81 KiB) Viewed 4690 times
Here's the whole train as it stands currently.

Code: Select all

//----------------------------------------------------------
// 700T Series Shinkansen
//----------------------------------------------------------
  421 * 79	 00 00 20 01 FA 
			00 10 72 
			02 06 
			03 1E 
			04 FF 
			05 01 
			06 03 
			07 0A 
			08 01 
			09 2C 01 //Speed
			0B E4 25 //Power
			0D 96 
			0E 3C 4C 00 00 
			12 FD 
			13 00 
			14 FA //Cargo capacity
			15 00 
			16 5E //Weight
			17 70 
			18 00 
			19 31 
			1A 1B 
			1B 00 00 
			1C 00 
			1D 01 00 00 00 
			1E 11 
			1F 1E //TE
			20 02 
			21 00 
			22 00 
			23 0E 
			24 01
			27 04
//
//
//Front
  422 * 4	 01 00 05 08
  423 f:\mps\ttwin95\sprites/SH700T.pcx 2 40 01 28 8 -3 -16
  424 f:\mps\ttwin95\sprites/SH700T.pcx 18 40 09 21 24 -14 -13
  425 f:\mps\ttwin95\sprites/SH700T.pcx 50 40 01 16 32 -16 -12
  426 f:\mps\ttwin95\sprites/SH700T.pcx 98 40 09 21 21 -6 -13
  427 f:\mps\ttwin95\sprites/SH700T.pcx 130 40 01 28 8 -3 -16
  428 f:\mps\ttwin95\sprites/SH700T.pcx 146 40 09 21 22 -14 -13
  429 f:\mps\ttwin95\sprites/SH700T.pcx 178 40 01 16 32 -16 -12
  430 f:\mps\ttwin95\sprites/SH700T.pcx 226 40 09 21 24 -8 -13
//
//Back
  431 f:\mps\ttwin95\sprites/SH700T.pcx 2 88 01 28 8 -3 -16
  432 f:\mps\ttwin95\sprites/SH700T.pcx 18 88 09 21 22 -14 -13
  433 f:\mps\ttwin95\sprites/SH700T.pcx 50 88 01 16 32 -16 -12
  434 f:\mps\ttwin95\sprites/SH700T.pcx 98 88 09 21 24 -8 -13
  435 f:\mps\ttwin95\sprites/SH700T.pcx 130 88 01 28 8 -3 -16
  436 f:\mps\ttwin95\sprites/SH700T.pcx 146 88 09 21 24 -14 -13
  437 f:\mps\ttwin95\sprites/SH700T.pcx 178 88 01 16 32 -16 -12
  438 f:\mps\ttwin95\sprites/SH700T.pcx 226 88 09 21 21 -6 -13
//
//Coach
  439 f:\mps\ttwin95\sprites/SH700T.pcx 2 136 01 28 8 -3 -16
  440 f:\mps\ttwin95\sprites/SH700T.pcx 18 136 09 21 22 -14 -13
  441 f:\mps\ttwin95\sprites/SH700T.pcx 50 136 01 16 32 -16 -12
  442 f:\mps\ttwin95\sprites/SH700T.pcx 98 136 09 21 22 -6 -13
  443 f:\mps\ttwin95\sprites/SH700T.pcx 130 136 01 28 8 -3 -16
  444 f:\mps\ttwin95\sprites/SH700T.pcx 146 136 09 21 22 -14 -13
  445 f:\mps\ttwin95\sprites/SH700T.pcx 178 136 01 16 32 -16 -12
  446 f:\mps\ttwin95\sprites/SH700T.pcx 226 136 09 21 22 -6 -13
//
//Panto D0
  447 f:\mps\ttwin95\sprites/SH700T.pcx 2 184 01 28 8 -3 -16
  448 f:\mps\ttwin95\sprites/SH700T.pcx 18 184 09 21 22 -14 -13
  449 f:\mps\ttwin95\sprites/SH700T.pcx 50 184 01 16 32 -16 -12
  450 f:\mps\ttwin95\sprites/SH700T.pcx 98 184 09 21 22 -6 -13
  451 f:\mps\ttwin95\sprites/SH700T.pcx 130 184 01 28 8 -3 -16
  452 f:\mps\ttwin95\sprites/SH700T.pcx 146 184 09 21 22 -14 -13
  453 f:\mps\ttwin95\sprites/SH700T.pcx 178 184 01 16 32 -16 -12
  454 f:\mps\ttwin95\sprites/SH700T.pcx 226 184 09 21 22 -6 -13
//
//Panto D1
  455 f:\mps\ttwin95\sprites/SH700T.pcx 2 232 01 28 8 -3 -16
  456 f:\mps\ttwin95\sprites/SH700T.pcx 18 232 09 21 22 -14 -13
  457 f:\mps\ttwin95\sprites/SH700T.pcx 50 232 01 16 32 -16 -12
  458 f:\mps\ttwin95\sprites/SH700T.pcx 98 232 09 21 22 -6 -13
  459 f:\mps\ttwin95\sprites/SH700T.pcx 130 232 01 28 8 -3 -16
  460 f:\mps\ttwin95\sprites/SH700T.pcx 146 232 09 21 22 -14 -13
  461 f:\mps\ttwin95\sprites/SH700T.pcx 178 232 01 16 32 -16 -12
  462 f:\mps\ttwin95\sprites/SH700T.pcx 226 232 09 21 22 -6 -13
//
//Dummy Front
//  463 f:\mps\ttwin95\sprites/SH700T.pcx 2 280 01 28 8 -3 -16
//  464 f:\mps\ttwin95\sprites/SH700T.pcx 18 280 09 21 24 -14 -13
//  465 f:\mps\ttwin95\sprites/SH700T.pcx 50 280 01 16 32 -16 -12
//  466 f:\mps\ttwin95\sprites/SH700T.pcx 98 280 09 21 21 -6 -13
//  467 f:\mps\ttwin95\sprites/SH700T.pcx 130 280 01 28 8 -3 -16
//  468 f:\mps\ttwin95\sprites/SH700T.pcx 146 280 09 21 22 -14 -13
//  469 f:\mps\ttwin95\sprites/SH700T.pcx 178 280 01 16 32 -16 -12
//  470 f:\mps\ttwin95\sprites/SH700T.pcx 226 280 09 21 24 -8 -13
//
//Dummy Back
//  471 f:\mps\ttwin95\sprites/SH700T.pcx 2 315 01 28 8 -3 -16
//  472 f:\mps\ttwin95\sprites/SH700T.pcx 18 315 09 21 22 -14 -13
//  473 f:\mps\ttwin95\sprites/SH700T.pcx 50 315 01 16 32 -16 -12
//  474 f:\mps\ttwin95\sprites/SH700T.pcx 98 315 09 21 24 -8 -13
//  475 f:\mps\ttwin95\sprites/SH700T.pcx 130 315 01 28 8 -3 -16
//  476 f:\mps\ttwin95\sprites/SH700T.pcx 146 315 09 21 24 -14 -13
//  477 f:\mps\ttwin95\sprites/SH700T.pcx 178 315 01 16 32 -16 -12
//  478 f:\mps\ttwin95\sprites/SH700T.pcx 226 315 09 21 21 -6 -13
//
//
  463 * 9	 02 00 00 01 01 00 00 00 00	// FRONT
  464 * 9	 02 00 01 01 01 01 00 01 00	// BACK
  465 * 9	 02 00 02 01 01 02 00 02 00	// COACH
  466 * 9	 02 00 03 01 01 03 00 03 00	// PANTO 1
  467 * 9	 02 00 04 01 01 04 00 04 00 // PANTO 2
//  484 * 9	 02 00 05 01 01 05 00 05 00 // Dummy FRONT
//  485 * 9	 02 00 06 01 01 06 00 06 00 // Dummy BACK
// 
  468 * 34	 02 00 10 81 40 00 0B 06
   			01 00 0B 0B // Back
			02 00 09 0A // 10th to 11th coach
			03 00 08 08 // 5th car Second Panto
			02 00 04 07	// 5th to 8th coach
			04 00 03 03	// 3th car First Panto
			02 00 01 02	// 2nd to 3rd coach
			00 00		// 1st car Front
// set CB 16 (articulated vehicle)
  469 * 14	 02 00 11 81 10 00 FF 01
			7F 80 01 0B	// 11 additional parts of veh-ID 7F (base articulated car)
			FF 80		// end articulated vehicle		

// set CB 1D (engine attach)
// 
  470 * 14	 02 00 12 82 40 10 FF 01
			FE 80 00 0C	//
			20 80		// error: "wrong number of cars" 

//
  471 * 18	 02 00 13 81 C6 00 FF 02
			12 00 FA FA
			12 00 7F 7F
			21 80		// error: "wrong type of car"
//
//process callback 10 (powered wagon)
  472 * 18	 02 00 15 81 40 00 07 02
			34 80 03 03
			34 80 08 08
			40 80
//
// switch between callback and graphics branch
  473 * 22	 02 00 18 81 0C 00 FF 03
         15 00 10 10 // is CB 10, handle it
         11 00 16 16 // is CB 16, handle it
         13 00 1D 1D // is CB 1D, handle it
         10 00       // graphics

//----------------------------------------------------------
// menu entry
//----------------------------------------------------------

  474 * 6	 01 00 01 FF 01 00
  475 f:\mps\ttwin95\sprites/SH700T.pcx 18 8 01 16 50 -25 -10
  476 * 9	 02 00 00 01 01 00 00 00 00
//  
// switch between callback and graphics branch
  477 * 23	 02 00 01 85 0C 00 FF FF 02
		05 00 16 00 16 00	// CB 16 (for capacity calculation)
		22 80 23 00 23 00	// CB 23, show additional text
		00 00			// graphics
  478 * 28	 04 00 01 01 FA "700T Series Shinkansen" 00
  479 * 10	 03 00 01 FA 01 FF 01 00 18 00
  480 * 7	 03 00 81 7F 00 18 00
michael blunck wrote: Other than this, it´s quite similar to my ICE-3. I could post the code if you want to.
Yes it might be well be worth seeing it done right.

Much appreciated once again.
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Hargs' Articulation Woes

Post by michael blunck »

hargs wrote: Well I've to simplify it as best I could, though I might have just made it worse.

I'm now getting this, which looks as if something is causing it to reset the order at car 04.

Code: Select all

  468 * 34	 02 00 10 81 40 00 0B 06
   			01 00 0B 0B // Back
			02 00 09 0A // 10th to 11th coach
			03 00 08 08 // 5th car Second Panto
			02 00 04 07	// 5th to 8th coach
			04 00 03 03	// 3th car First Panto
			02 00 01 02	// 2nd to 3rd coach
			00 00		// 1st car Front

That´s because you´re AND-ing with 0B. I.e.:

4 -> 0100
B -> 1011

result is 0. :cool:

Just use 4 bits (counting till 16), like this:

Code: Select all

  468 * 34	 02 00 10 81 40 00 0F 06
Or all bits, counting up to 255 coaches/vehicles:

Code: Select all

  468 * 34	 02 00 10 81 40 00 FF 06
Does it work?

regards
Michael
Image
User avatar
hargs
Traffic Manager
Traffic Manager
Posts: 129
Joined: 13 Feb 2012 23:19
Location: Manchester. UK.

Re: Hargs' Articulation Woes

Post by hargs »

hargs wrote:Does it work?
It does indeed.
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Hargs' Articulation Woes

Post by michael blunck »

hargs wrote:
mb wrote:Does it work?
It does indeed.
OK, case closed?

BTW, AND-ing your coach numbers with 11 (== 0B, 1011b) not only results into 0 for 4, but also into 1 for 5, into 2 for 6, 3 for 7 etc. Exactly the result your image above did show. :cool:

regards
Michael
Image
User avatar
hargs
Traffic Manager
Traffic Manager
Posts: 129
Joined: 13 Feb 2012 23:19
Location: Manchester. UK.

Re: Hargs' Articulation Woes

Post by hargs »

michael blunck wrote:OK, case closed?
ha ha for now at least. Though I suspect they'll be many more issues to come.

Thanks again for the help.
User avatar
hargs
Traffic Manager
Traffic Manager
Posts: 129
Joined: 13 Feb 2012 23:19
Location: Manchester. UK.

Re: Hargs' Articulation Woes

Post by hargs »

Well here I am again, this time I'm trying to get load amount set by a call back and get the purchase list to recognise the full capacity from another call back.
Also there's probably lots of other things I've done wrong in there as well.

Code: Select all

//D0 
  762 * 28	 02 00 10 81 40 80 FF 00 \b5 \b4				
				00 00 00 00 // Front F//C//P//C//B  
				02 00 01 01 // 
				04 00 02 02 // 
				02 00 03 03 //
				01 00	
//	D1
  763 * 28	 02 00 20 81 40 80 FF 00 \b5 \b4				
				00 00 00 00 // Front F//C//P//C//B 
				02 00 03 03	//
				05 00 02 02 //
				02 00 01 01 //	
				01 00	
//	
//check direction (D0 or D1):
  764 * 14	 02 00 30 82 FF 00 01 01 10 00 00 00 20 00
//
// set CB 16 (articulated vehicle)
  765 * 14	 02 00 11 81 10 00 FF 01
				7E 80 01 04	// 4 additional parts of veh-ID 7E (base articulated car NG)
				FF 80		// end articulated vehicle		
// set CB 1D (engine attach)
// 
  766 * 14	 02 00 12 81 40 10 FF 01
				FE 80 00 0F	//
				20 80		// error: "wrong number of cars" 

//
  767 * 18	 02 00 13 81 C6 00 FF 02
				12 00 A4 A4
				12 00 7E 7E
				21 80		// error: "wrong type of car"
//
//
//process callback 10 (powered wagon) D0
  768 * 14	 02 00 15 81 40 00 0F 01
				3C 80 02 02
				40 80
//
//process callback 10 (powered wagon) D1
  769 * 14	 02 00 16 81 40 00 0F 01
				34 80 02 02
				40 80
//check direction for callback 10:
  770 * 14	 02 00 17 82 FF 00 01 01 16 00 00 00 15 00
//
//  
  771 * 11	 02 00 40 81 7E 10 00 \b32 00  // I'm really just guessing with this, hence why it doesn't work
				00 80
//
  772 * 11	 02 00 41 81 7E 10 00 \b66 00 //new capacity
				00 80				
//					
  773 * 14	 02 00 42 81 10 00 FF 01
				41 00 14 14
				18 00
//
//  
// switch between callback and graphics branch
  774 * 34	 02 00 18 81 0C 00 FF 06
		 40 00 12 12 // CB 12
                 01 80 11 11 // CB 11 Shorten to 7/8
		 17 00 10 10 // CB 10
                 11 00 16 16 // CB 16
                 13 00 1D 1D // CB 1D
		 42 00 36 36
         30 00       // graphics
// 
//----------------------------------------------------------
// menu entry
//----------------------------------------------------------

  775 * 6	 01 00 01 FF 01 00
  776 f:\mps\ttwin95\sprites/EME231mh.pcx 18 8 01 16 54 -25 -10
  777 * 9	 02 00 00 01 01 00 00 00 00
//
  778 * 14	 02 00 19 81 10 00 FF 01  //Pretty much the same down here
				18 00 14 14
				01 00
  779 * 18	 02 00 01 81 0C 00 FF 02
				22 80 23 23
				19 00 36 36
				00 00		
  780 * 30	 04 00 01 01 A4 "E231-Kinkou Type (5 car)" 00
  781 * 10	 03 00 01 A4 01 FF 01 00 18 00
  782 * 7	 03 00 81 7E 00 18 00
Thanks in advance for any help offered.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Hargs' Articulation Woes

Post by PikkaBird »

hargs wrote:// I'm really just guessing with this, hence why it doesn't work
Yes, yes you are.

Either return the value immediately

Code: Select all

  773 * 14	 02 00 42 81 10 00 FF 01
				\b66 80 14 14
				18 00
//
//  
// switch between callback and graphics branch
  774 * 34	 02 00 18 81 0C 00 FF 06
                 \b32 80 12 12 // CB 12
                 01 80 11 11 // CB 11 Shorten to 7/8
                 17 00 10 10 // CB 10
                 11 00 16 16 // CB 16
                 13 00 1D 1D // CB 1D
                 42 00 36 36
         30 00       // graphics

Or, if you really want the additional lines, use var 1A to provide a constant.

Code: Select all

  771 * 11	 02 00 40 81 1A 00 \b32 00 00 80 // cb 12 capacity
//
  772 * 11	 02 00 41 81 1A 00 \b66 00 00 80 // cb 36 capacity				
//					
  773 * 14	 02 00 42 81 10 00 FF 01
				41 00 14 14
				18 00
//
//  
// switch between callback and graphics branch
  774 * 34	 02 00 18 81 0C 00 FF 06
                 40 00 12 12 // CB 12
                 01 80 11 11 // CB 11 Shorten to 7/8
                 17 00 10 10 // CB 10
                 11 00 16 16 // CB 16
                 13 00 1D 1D // CB 1D
                 42 00 36 36
         30 00       // graphics
User avatar
hargs
Traffic Manager
Traffic Manager
Posts: 129
Joined: 13 Feb 2012 23:19
Location: Manchester. UK.

Re: Hargs' Articulation Woes

Post by hargs »

Ah thanks that did the trick. Well it did when I remembered to set the callback bit *sigh*.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Hargs' Articulation Woes

Post by planetmaker »

Do you know of NML?

Code: Select all

//set number of articulated parts
switch (FEAT_ROADVEHS, SELF, switch_articulated_htm_4001, extra_callback_info1) {
    1..2: return item_tram_htm_4001; //use same vehicle for all parts
    return CB_RESULT_NO_MORE_ARTICULATED_PARTS; //stop adding vehicle parts
}

//////////////////////
//vehicle properties//
//////////////////////

item (FEAT_ROADVEHS, item_tram_htm_4001) {
    property {
        name:                        string(STR_NAME_HTM_4001);
        introduction_date:           date(2006,1,1);
(...)
    }
    graphics {
        articulated_part:        switch_articulated_htm_4001;
    }
}
User avatar
hargs
Traffic Manager
Traffic Manager
Posts: 129
Joined: 13 Feb 2012 23:19
Location: Manchester. UK.

Re: Hargs' Articulation Woes

Post by hargs »

I have but to be honest it looks more complicated than the NFO stuff to me, but I may look into NML and m4NFO when I get a bit more time.

PS still having trouble getting capacity to display correctly in the price list.
Supercheese
Tycoon
Tycoon
Posts: 1660
Joined: 16 Dec 2007 22:24
Location: Idaho, USA

Re: Hargs' Articulation Woes

Post by Supercheese »

hargs wrote:I have but to be honest it looks more complicated than the NFO stuff to me...
Believe me, it is not; 'tis far, far simpler and easier to read & understand IMO.
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects

"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: Hargs' Articulation Woes

Post by Eddi »

hargs wrote:PS still having trouble getting capacity to display correctly in the price list.
that is a fairly common problem. the capacity callback is not run on the purchase list, only the capacity property can be considered at that point. you need to provide more details on what you're trying to achieve, though.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Hargs' Articulation Woes

Post by PikkaBird »

Eddi wrote:
hargs wrote:PS still having trouble getting capacity to display correctly in the price list.
that is a fairly common problem. the capacity callback is not run on the purchase list, only the capacity property can be considered at that point. you need to provide more details on what you're trying to achieve, though.
You can use cb36 to provide a capacity for the purchase list IIRC. The "refitted capacity" callback indeed is only called when building or refitting.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Hargs' Articulation Woes

Post by PikkaBird »

Supercheese wrote:'tis far, far simpler and easier to read & understand IMO.
It's certainly a lot more verbose. Whether it's easier to work with or not depends on the individual.

What's going on under the hood, otoh, is identical whether you're using NFO or NML, so you still need the same understanding of the logic and of the grf spec.
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5705
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Hargs' Articulation Woes

Post by andythenorth »

[off topic]
NML and NFO are about even imo for ease-of-use. I find NML is easier to template, because there is no need to do housekeeping for sizes (bytes, words, dwords) of props, vars etc. Either way, knowing the grf spec helps ;)
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Hargs' Articulation Woes

Post by michael blunck »

[slightly OT]
PikkaBird wrote: What's going on under the hood, otoh, is identical whether you're using NFO or NML [...]
Only in general. But in particular, only when using plain nfo or m4nfo the coder has complete control over the generated nfo code.

regards
Michael
Image
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 7 guests