<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://www.tt-wiki.net/index.php?action=history&amp;feed=atom&amp;title=NMLTutorial%2FTram_graphics</id>
	<title>NMLTutorial/Tram graphics - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.tt-wiki.net/index.php?action=history&amp;feed=atom&amp;title=NMLTutorial%2FTram_graphics"/>
	<link rel="alternate" type="text/html" href="https://www.tt-wiki.net/index.php?title=NMLTutorial/Tram_graphics&amp;action=history"/>
	<updated>2026-05-02T03:17:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://www.tt-wiki.net/index.php?title=NMLTutorial/Tram_graphics&amp;diff=8339&amp;oldid=prev</id>
		<title>FooBar: use length instead of shorten_vehicle</title>
		<link rel="alternate" type="text/html" href="https://www.tt-wiki.net/index.php?title=NMLTutorial/Tram_graphics&amp;diff=8339&amp;oldid=prev"/>
		<updated>2012-05-03T16:47:29Z</updated>

		<summary type="html">&lt;p&gt;use length instead of shorten_vehicle&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:47, 3 May 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 95:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 95:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Shorten&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;vehicle&lt;/del&gt; callback ==&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Vehicle&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;length&lt;/ins&gt; callback ==&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If you did encode the previous results, you&#039;ll notice that the individual vehicle parts are very far apart. This is because we used shorter sprites than the 32px default length. We&#039;ll need to tell the game that our vehicle parts are shorter!&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If you did encode the previous results, you&#039;ll notice that the individual vehicle parts are very far apart. This is because we used shorter sprites than the 32px default length. We&#039;ll need to tell the game that our vehicle parts are shorter!&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is done by means of the&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; shorten&lt;/del&gt; vehicle callback, incidentally named &amp;lt;code&amp;gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;shorten_vehicle&lt;/del&gt;&amp;lt;/code&amp;gt; for use in the graphics block, look it up [http://newgrf-specs.tt-wiki.net/wiki/NML:Vehicles#Vehicle_callbacks here]. Because different parts have different lengths, we once more can&#039;t just return a value from the graphics block but need an intermediate switch block:&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is done by means of the vehicle&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; length&lt;/ins&gt; callback, incidentally named &amp;lt;code&amp;gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;length&lt;/ins&gt;&amp;lt;/code&amp;gt; for use in the graphics block, look it up [http://newgrf-specs.tt-wiki.net/wiki/NML:Vehicles#Vehicle_callbacks here]. Because different parts have different lengths, we once more can&#039;t just return a value from the graphics block but need an intermediate switch block:&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre style=&quot;color:darkblue; white-space: pre-wrap;&quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre style=&quot;color:darkblue; white-space: pre-wrap;&quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    graphics {&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    graphics {&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        articulated_part:        switch_articulated_htm_4001;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        articulated_part:        switch_articulated_htm_4001;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;shorten_vehicle&lt;/del&gt;:         switch_length_htm_4001; //&amp;lt;-- this one is added now&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;length&lt;/ins&gt;:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;         &lt;/ins&gt;         switch_length_htm_4001; //&amp;lt;-- this one is added now&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        cargo_capacity:          switch_capacity_htm_4001;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        cargo_capacity:          switch_capacity_htm_4001;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        default:                 switch_spriteset_htm_4001;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        default:                 switch_spriteset_htm_4001;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 109:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 109:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The switch block itself will once more make a decision based on the &amp;lt;code&amp;gt;position_in_consist&amp;lt;/code&amp;gt; variable. The value to return for the callback is &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;how&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;many&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;times&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;12&lt;/del&gt;,&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;5%&lt;/del&gt; (&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;1/8&lt;/del&gt;) &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;to&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;reduce&lt;/del&gt; the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;vehicle&lt;/del&gt; length &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;with&lt;/del&gt;. The first and last part of the vehicle are 28px, which &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;is (1/8) shorter than 32px, so the&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;return&lt;/del&gt; value &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;here&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;is 1&lt;/del&gt;. The middle part is 24px, which &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;is&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(2/8) shorter so the return&lt;/del&gt; value &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;for this part is&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2&lt;/del&gt;. The switch block:&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The switch block itself will once more make a decision based on the &amp;lt;code&amp;gt;position_in_consist&amp;lt;/code&amp;gt; variable. The value to return for the callback is &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;desired&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;length&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;of the vehicle part&lt;/ins&gt;,&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; where 8 is longest possible length&lt;/ins&gt; (&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;32px&lt;/ins&gt;) &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;and&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;1 is&lt;/ins&gt; the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;shortest possible&lt;/ins&gt; length &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(4px)&lt;/ins&gt;. The first and last part of the vehicle are 28px, which &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;equals&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a&lt;/ins&gt; value &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;of&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;7&lt;/ins&gt;. The middle part is 24px, which &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;equals&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a&lt;/ins&gt; value &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;of&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;6&lt;/ins&gt;. The switch block:&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre style=&quot;color:darkblue; white-space: pre-wrap;&quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre style=&quot;color:darkblue; white-space: pre-wrap;&quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;switch (FEAT_ROADVEHS, SELF, switch_length_htm_4001, position_in_consist&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;) {&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;switch (FEAT_ROADVEHS, SELF, switch_length_htm_4001, position_in_consist) {&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    1: return &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2&lt;/del&gt;;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    1: return &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;6&lt;/ins&gt;;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    return &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;1&lt;/del&gt;;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    return &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;7&lt;/ins&gt;;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The second vehicle part (with index 1 in &amp;lt;code&amp;gt;position_in_consist&amp;lt;/code&amp;gt;) returns value &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2&lt;/del&gt; and value &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;1&lt;/del&gt; is returned for all other positions (the first and last part of the vehicle). Once more notice that the identifier of the switch block is the same as that used in the graphics block.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The second vehicle part (with index 1 in &amp;lt;code&amp;gt;position_in_consist&amp;lt;/code&amp;gt;) returns value &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;6&lt;/ins&gt; and&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; a default&lt;/ins&gt; value &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;7&lt;/ins&gt; is returned for all other positions (the first and last part of the vehicle)&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. Counting of the vehicle parts starts at zero and you only have to list the part numbers that differ from the default you&#039;ll be specifying&lt;/ins&gt;. Once more notice that the identifier of the switch block is the same as that used in the graphics block.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This should fix our vehicle and now the parts actually appear connected.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This should fix our vehicle and now the parts actually appear connected.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 167:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 167:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;//set length of each part&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;//set length of each part&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;switch (FEAT_ROADVEHS, SELF, switch_length_htm_4001, position_in_consist&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;) {&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;switch (FEAT_ROADVEHS, SELF, switch_length_htm_4001, position_in_consist) {&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    1: return &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2&lt;/del&gt;;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    1: return &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;6&lt;/ins&gt;;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    return &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;1&lt;/del&gt;;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    return &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;7&lt;/ins&gt;;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 213:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 213:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    graphics {&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    graphics {&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        articulated_part:        switch_articulated_htm_4001;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        articulated_part:        switch_articulated_htm_4001;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;shorten_vehicle&lt;/del&gt;:         &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;switch_length_htm_4001;&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;//&amp;lt;--&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;this&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;one&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;is&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;added&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;now&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;length&lt;/ins&gt;:               &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;   switch_length_htm_4001;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        cargo_capacity:          switch_capacity_htm_4001;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        cargo_capacity:          switch_capacity_htm_4001;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        default:                 switch_spriteset_htm_4001;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        default:                 switch_spriteset_htm_4001;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>FooBar</name></author>
	</entry>
	<entry>
		<id>https://www.tt-wiki.net/index.php?title=NMLTutorial/Tram_graphics&amp;diff=7981&amp;oldid=prev</id>
		<title>Yexo: /* Total code so far */</title>
		<link rel="alternate" type="text/html" href="https://www.tt-wiki.net/index.php?title=NMLTutorial/Tram_graphics&amp;diff=7981&amp;oldid=prev"/>
		<updated>2011-12-13T22:27:41Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Total code so far&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:27, 13 December 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 163:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 163:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;switch (FEAT_ROADVEHS, SELF, switch_articulated_htm_4001, extra_callback_info1) {&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;switch (FEAT_ROADVEHS, SELF, switch_articulated_htm_4001, extra_callback_info1) {&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    1..2: return item_tram_htm_4001; //use same vehicle for all parts&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    1..2: return item_tram_htm_4001; //use same vehicle for all parts&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    return &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;0xFF&lt;/del&gt;; //stop adding vehicle parts&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    return &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;CB_RESULT_NO_MORE_ARTICULATED_PARTS&lt;/ins&gt;; //stop adding vehicle parts&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Yexo</name></author>
	</entry>
	<entry>
		<id>https://www.tt-wiki.net/index.php?title=NMLTutorial/Tram_graphics&amp;diff=7659&amp;oldid=prev</id>
		<title>FooBar: page contents</title>
		<link rel="alternate" type="text/html" href="https://www.tt-wiki.net/index.php?title=NMLTutorial/Tram_graphics&amp;diff=7659&amp;oldid=prev"/>
		<updated>2011-08-24T21:26:47Z</updated>

		<summary type="html">&lt;p&gt;page contents&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{NMLTutorial}}&lt;br /&gt;
&amp;#039;&amp;#039;The example used here is the HTM 4001 from the [http://dev.openttdcoop.org/projects/dutchtramset/repository Dutch Tram Set]. The original code and graphics for this are by FooBar. Code and graphics are both licensed according to the GPL v2 or later. The code has been modified for the purpose of this tutorial.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This continues the [[NMLTutorial/Tram articulation|second part]] of the tram example. Now graphics will be added to the tram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The graphics ==&lt;br /&gt;
As this tutorial is about coding NML and not about drawing graphics, we&amp;#039;ll give you the graphics for free:&lt;br /&gt;
&lt;br /&gt;
[[Image:Htm 4001.png|frame|none|Graphics for each part of the HTM 4001. Drawn by FooBar.]]&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
The graphics in this file are templated (and actually use the templates used as example for the template chapter of this tutorial). That means we&amp;#039;ll be using templates here as well. Check [[NMLTutorial/Template|back]] if you don&amp;#039;t remember how to do that. These are the templates you should end up with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:darkblue; white-space: pre-wrap;&amp;quot;&amp;gt;&lt;br /&gt;
template template_tram_28(x, y) {&lt;br /&gt;
    //[left_x,  upper_y,    width,     height,     offset_x,     offset_y]&lt;br /&gt;
    [x,         y,          10,        28,           -4,         -11]&lt;br /&gt;
    [x+ 20,     y,          26,        28,          -17,         -14]&lt;br /&gt;
    [x+ 50,     y,          36,        28,          -20,         -20]&lt;br /&gt;
    [x+ 90,     y,          26,        28,           -9,         -15]&lt;br /&gt;
    [x+120,     y,          10,        28,           -4,         -13]&lt;br /&gt;
    [x+140,     y,          26,        28,          -16,         -16]&lt;br /&gt;
    [x+170,     y,          36,        28,          -16,         -20]&lt;br /&gt;
    [x+210,     y,          26,        28,           -8,         -16]&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
template template_tram_24(x, y) {&lt;br /&gt;
    //[left_x,  upper_y,    width,     height,     offset_x,     offset_y]&lt;br /&gt;
    [x,         y,          10,        28,           -4,         -11]&lt;br /&gt;
    [x+ 20,     y,          26,        28,          -17,         -14]&lt;br /&gt;
    [x+ 50,     y,          36,        28,          -22,         -20]&lt;br /&gt;
    [x+ 90,     y,          26,        28,           -9,         -15]&lt;br /&gt;
    [x+120,     y,          10,        28,           -4,         -15]&lt;br /&gt;
    [x+140,     y,          26,        28,          -16,         -16]&lt;br /&gt;
    [x+170,     y,          36,        28,          -14,         -20]&lt;br /&gt;
    [x+210,     y,          26,        28,           -8,         -16]&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
template template_purchase(x, y) {&lt;br /&gt;
    //[left_x,  upper_y,    width,     height,     offset_x,     offset_y]&lt;br /&gt;
    [x,         y,          50,        12,          -25,          -6]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The purchase menu sprite will be added on the next page, but it doesn&amp;#039;t hurt to have the template defined now. Every template has arguments for the position of the top left sprite corner.&lt;br /&gt;
&lt;br /&gt;
=== Spritesets ===&lt;br /&gt;
With these templates, we can make three spritesets for the three vehicle parts. We give the spritesets proper names and include a reference to the image file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:darkblue; white-space: pre-wrap;&amp;quot;&amp;gt;&lt;br /&gt;
spriteset(spriteset_real_htm_4001, &amp;quot;gfx/htm_4001.png&amp;quot;) {&lt;br /&gt;
    template_tram_28(0, 20)&lt;br /&gt;
}&lt;br /&gt;
spriteset(spriteset_real_htm_4001_1, &amp;quot;gfx/htm_4001.png&amp;quot;) {&lt;br /&gt;
    template_tram_24(0, 60)&lt;br /&gt;
}&lt;br /&gt;
spriteset(spriteset_real_htm_4001_2, &amp;quot;gfx/htm_4001.png&amp;quot;) {&lt;br /&gt;
    template_tram_28(0, 100)&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the first and last vehicle part are 28 px long and use the 28 px template. The middle part is only 24 px long and uses the 24 px template.&lt;br /&gt;
&lt;br /&gt;
Because there are no different sprites for &amp;quot;empty&amp;quot;, &amp;quot;full&amp;quot;, &amp;quot;loaded&amp;quot; and &amp;quot;loading&amp;quot;, we don&amp;#039;t have to define a spritegroup in this case. If you had different sprites for these different states, you would need to combine them in a spritegroup first.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Attaching the graphics with a switch block ==&lt;br /&gt;
From the graphics block we will use the &amp;#039;&amp;#039;default&amp;#039;&amp;#039; callback to reference the spritesets. However, because we can reference only one spriteset (or -group) from the graphics block, we need an intermediate switch block to decide the graphics depending on the position in the vehicle.&lt;br /&gt;
&lt;br /&gt;
So from the graphics block we reference a switch block for the default graphics:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:darkblue; white-space: pre-wrap;&amp;quot;&amp;gt;&lt;br /&gt;
    graphics {&lt;br /&gt;
        articulated_part:        switch_articulated_htm_4001;&lt;br /&gt;
        cargo_capacity:          switch_capacity_htm_4001;&lt;br /&gt;
        default:                 switch_spriteset_htm_4001;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This then links to a switch block. The workings of this switch block will be similar to that of the cargo capacity callback, making a decicion based on the &amp;lt;code&amp;gt;position_in_consist&amp;lt;/code&amp;gt; [http://newgrf-specs.tt-wiki.net/wiki/NML:Vehicles#Vehicle_variables variable]. However, this time we need three separate ranges (because three different spritesets) and we mustn&amp;#039;t return a value but now reference these spritesets:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:darkblue; white-space: pre-wrap;&amp;quot;&amp;gt;&lt;br /&gt;
switch (FEAT_ROADVEHS, SELF, switch_spriteset_htm_4001, position_in_consist ) {&lt;br /&gt;
    1: spriteset_real_htm_4001_1;&lt;br /&gt;
    2: spriteset_real_htm_4001_2;&lt;br /&gt;
    spriteset_real_htm_4001; //default&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for the second vehicle part (with index 1 in &amp;lt;code&amp;gt;position_in_consist&amp;lt;/code&amp;gt;) we use the graphics of the &amp;#039;spriteset_real_htm_4001_1&amp;#039; spriteset block. For the last part (index 2) we use the &amp;#039;&amp;#039;spriteset_real_htm_4001_2&amp;#039;&amp;#039; spriteset. For all other parts (in this case only the first) we&amp;#039;ll default to the &amp;#039;&amp;#039;spriteset_real_htm_4001&amp;#039;&amp;#039; spriteset.&lt;br /&gt;
&lt;br /&gt;
This has the graphics sorted and you can encode the NewGRF to see the result ingame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Shorten vehicle callback ==&lt;br /&gt;
If you did encode the previous results, you&amp;#039;ll notice that the individual vehicle parts are very far apart. This is because we used shorter sprites than the 32px default length. We&amp;#039;ll need to tell the game that our vehicle parts are shorter!&lt;br /&gt;
&lt;br /&gt;
This is done by means of the shorten vehicle callback, incidentally named &amp;lt;code&amp;gt;shorten_vehicle&amp;lt;/code&amp;gt; for use in the graphics block, look it up [http://newgrf-specs.tt-wiki.net/wiki/NML:Vehicles#Vehicle_callbacks here]. Because different parts have different lengths, we once more can&amp;#039;t just return a value from the graphics block but need an intermediate switch block:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:darkblue; white-space: pre-wrap;&amp;quot;&amp;gt;&lt;br /&gt;
    graphics {&lt;br /&gt;
        articulated_part:        switch_articulated_htm_4001;&lt;br /&gt;
        shorten_vehicle:         switch_length_htm_4001; //&amp;lt;-- this one is added now&lt;br /&gt;
        cargo_capacity:          switch_capacity_htm_4001;&lt;br /&gt;
        default:                 switch_spriteset_htm_4001;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switch block itself will once more make a decision based on the &amp;lt;code&amp;gt;position_in_consist&amp;lt;/code&amp;gt; variable. The value to return for the callback is how many times 12,5% (1/8) to reduce the vehicle length with. The first and last part of the vehicle are 28px, which is (1/8) shorter than 32px, so the return value here is 1. The middle part is 24px, which is (2/8) shorter so the return value for this part is 2. The switch block:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:darkblue; white-space: pre-wrap;&amp;quot;&amp;gt;&lt;br /&gt;
switch (FEAT_ROADVEHS, SELF, switch_length_htm_4001, position_in_consist ) {&lt;br /&gt;
    1: return 2;&lt;br /&gt;
    return 1;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second vehicle part (with index 1 in &amp;lt;code&amp;gt;position_in_consist&amp;lt;/code&amp;gt;) returns value 2 and value 1 is returned for all other positions (the first and last part of the vehicle). Once more notice that the identifier of the switch block is the same as that used in the graphics block.&lt;br /&gt;
&lt;br /&gt;
This should fix our vehicle and now the parts actually appear connected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Total code so far ==&lt;br /&gt;
If you put everything in the correct order, you should have this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:darkblue; white-space: pre-wrap; max-height: 200px; overflow:scroll&amp;quot;&amp;gt;&lt;br /&gt;
// define the newgrf&lt;br /&gt;
grf {&lt;br /&gt;
	grfid:	&amp;quot;\FB\FB\01\02&amp;quot;;&lt;br /&gt;
	name:	string(STR_GRF_NAME);&lt;br /&gt;
	desc:	string(STR_GRF_DESCRIPTION);&lt;br /&gt;
	version:		REPO_REVISION;&lt;br /&gt;
	min_compatible_version:	87;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////&lt;br /&gt;
//Vehicle sprites//&lt;br /&gt;
///////////////////&lt;br /&gt;
&lt;br /&gt;
spriteset(spriteset_real_htm_4001, &amp;quot;gfx/htm_4001.png&amp;quot;) {&lt;br /&gt;
    template_tram_28(0, 20)&lt;br /&gt;
}&lt;br /&gt;
spriteset(spriteset_real_htm_4001_1, &amp;quot;gfx/htm_4001.png&amp;quot;) {&lt;br /&gt;
    template_tram_24(0, 60)&lt;br /&gt;
}&lt;br /&gt;
spriteset(spriteset_real_htm_4001_2, &amp;quot;gfx/htm_4001.png&amp;quot;) {&lt;br /&gt;
    template_tram_28(0, 100)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
switch (FEAT_ROADVEHS, SELF, switch_spriteset_htm_4001, position_in_consist ) {&lt;br /&gt;
    1: spriteset_real_htm_4001_1;&lt;br /&gt;
    2: spriteset_real_htm_4001_2;&lt;br /&gt;
    spriteset_real_htm_4001; //default&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/////////////////////&lt;br /&gt;
//vehicle callbacks//&lt;br /&gt;
/////////////////////&lt;br /&gt;
&lt;br /&gt;
//set number of articulated parts&lt;br /&gt;
switch (FEAT_ROADVEHS, SELF, switch_articulated_htm_4001, extra_callback_info1) {&lt;br /&gt;
    1..2: return item_tram_htm_4001; //use same vehicle for all parts&lt;br /&gt;
    return 0xFF; //stop adding vehicle parts&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//set length of each part&lt;br /&gt;
switch (FEAT_ROADVEHS, SELF, switch_length_htm_4001, position_in_consist ) {&lt;br /&gt;
    1: return 2;&lt;br /&gt;
    return 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//set capacity of each part&lt;br /&gt;
switch (FEAT_ROADVEHS, SELF, switch_capacity_htm_4001, position_in_consist ) {&lt;br /&gt;
    1: return 26;&lt;br /&gt;
    return 38; //default&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//////////////////////&lt;br /&gt;
//vehicle properties//&lt;br /&gt;
//////////////////////&lt;br /&gt;
&lt;br /&gt;
item (FEAT_ROADVEHS, item_tram_htm_4001) {&lt;br /&gt;
    property {&lt;br /&gt;
        name:                        string(STR_NAME_HTM_4001);&lt;br /&gt;
        introduction_date:           date(2006,1,1);&lt;br /&gt;
        model_life:                  VEHICLE_NEVER_EXPIRES;&lt;br /&gt;
        retire_early:                0;&lt;br /&gt;
        vehicle_life:                25;&lt;br /&gt;
        loading_speed:               25;&lt;br /&gt;
        cost_factor:                 224;&lt;br /&gt;
        running_cost_factor:         112;&lt;br /&gt;
        speed:                       81 km/h;&lt;br /&gt;
        power:                       966 hp;&lt;br /&gt;
        weight:                      58 ton;&lt;br /&gt;
        cargo_capacity:              (38*2+26)/3;&lt;br /&gt;
        tractive_effort_coefficient: 0.5;&lt;br /&gt;
        air_drag_coefficient:        0;&lt;br /&gt;
        //sound_effect:              no sound&lt;br /&gt;
        //visual_effect:             use default (none)&lt;br /&gt;
        &lt;br /&gt;
        //callback_flags:            no need to set this&lt;br /&gt;
        reliability_decay:           20;&lt;br /&gt;
        climates_available:          ALL_CLIMATES;&lt;br /&gt;
        refittable_cargo_classes:    bitmask(CC_PASSENGERS);&lt;br /&gt;
        sprite_id:                   SPRITE_ID_NEW_ROADVEH; //use custom sprites&lt;br /&gt;
        misc_flags:                  bitmask(ROADVEH_FLAG_TRAM); //make this a tram&lt;br /&gt;
        refit_cost:                  0; //refits are free&lt;br /&gt;
        running_cost_base:           RUNNING_COST_ROADVEH;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    graphics {&lt;br /&gt;
        articulated_part:        switch_articulated_htm_4001;&lt;br /&gt;
        shorten_vehicle:         switch_length_htm_4001; //&amp;lt;-- this one is added now&lt;br /&gt;
        cargo_capacity:          switch_capacity_htm_4001;&lt;br /&gt;
        default:                 switch_spriteset_htm_4001;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The graphics are there, the tram seems complete. Or is it? There still is a sprite for the purchase menu left and if you&amp;#039;ll look closely you&amp;#039;ll notice that the capacity displayed in the purchase menu isn&amp;#039;t correct. And remember the text we added to the language file to be displayed in the purchase menu? That&amp;#039;s all next, in the last part of this tram example.&lt;br /&gt;
&lt;br /&gt;
{{NMLTutorialNavbar|Tram articulation|Tram purchase menu}}&lt;/div&gt;</summary>
		<author><name>FooBar</name></author>
	</entry>
</feed>