Merge branch 'template_train_replacement' into template_train_replacement-sx
This commit is contained in:
		@@ -679,7 +679,7 @@ public:
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* Draw the template */
 | 
								/* Draw the template */
 | 
				
			||||||
			DrawTemplate(v, left + ScaleGUITrad(50), right, y);
 | 
								DrawTemplate(v, left + ScaleGUITrad(36), right - ScaleGUITrad(24), y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* Draw a notification string for chains that are not runnable */
 | 
								/* Draw a notification string for chains that are not runnable */
 | 
				
			||||||
			if (v->IsFreeWagonChain()) {
 | 
								if (v->IsFreeWagonChain()) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -119,16 +119,26 @@ void DrawTemplate(const TemplateVehicle *tv, int left, int right, int y)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	if (!tv) return;
 | 
						if (!tv) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						DrawPixelInfo tmp_dpi, *old_dpi;
 | 
				
			||||||
 | 
						int max_width = right - left + 1;
 | 
				
			||||||
 | 
						int height = ScaleGUITrad(14);
 | 
				
			||||||
 | 
						if (!FillDrawPixelInfo(&tmp_dpi, left, y, max_width, height)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						old_dpi = _cur_dpi;
 | 
				
			||||||
 | 
						_cur_dpi = &tmp_dpi;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const TemplateVehicle *t = tv;
 | 
						const TemplateVehicle *t = tv;
 | 
				
			||||||
	int offset = left;
 | 
						int offset = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (t) {
 | 
						while (t) {
 | 
				
			||||||
		PaletteID pal = GetEnginePalette(t->engine_type, _current_company);
 | 
							PaletteID pal = GetEnginePalette(t->engine_type, _current_company);
 | 
				
			||||||
		DrawSprite(t->cur_image, pal, offset, y + ScaleGUITrad(11));
 | 
							DrawSprite(t->cur_image, pal, offset + t->image_width / 2, ScaleGUITrad(11));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		offset += t->image_width;
 | 
							offset += t->image_width;
 | 
				
			||||||
		t = t->Next();
 | 
							t = t->Next();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_cur_dpi = old_dpi;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// copy important stuff from the virtual vehicle to the template
 | 
					// copy important stuff from the virtual vehicle to the template
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user