| 537 | } |
| 538 | |
| 539 | void DrawTrainEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type) |
| 540 | { |
| 541 | if (RailVehInfo(engine)->railveh_type == RAILVEH_MULTIHEAD) { |
| 542 | int yf = y; |
| 543 | int yr = y; |
| 544 | |
| 545 | VehicleSpriteSeq seqf, seqr; |
| 546 | GetRailIcon(engine, false, yf, image_type, &seqf); |
| 547 | GetRailIcon(engine, true, yr, image_type, &seqr); |
| 548 | |
| 549 | Rect rectf, rectr; |
| 550 | seqf.GetBounds(&rectf); |
| 551 | seqr.GetBounds(&rectr); |
| 552 | |
| 553 | preferred_x = Clamp(preferred_x, |
| 554 | left - UnScaleGUI(rectf.left) + ScaleSpriteTrad(14), |
| 555 | right - UnScaleGUI(rectr.right) - ScaleSpriteTrad(15)); |
| 556 | |
| 557 | seqf.Draw(preferred_x - ScaleSpriteTrad(14), yf, pal, pal == PALETTE_CRASH); |
| 558 | seqr.Draw(preferred_x + ScaleSpriteTrad(15), yr, pal, pal == PALETTE_CRASH); |
| 559 | } else { |
| 560 | VehicleSpriteSeq seq; |
| 561 | GetRailIcon(engine, false, y, image_type, &seq); |
| 562 | |
| 563 | Rect rect; |
| 564 | seq.GetBounds(&rect); |
| 565 | preferred_x = Clamp(preferred_x, |
| 566 | left - UnScaleGUI(rect.left), |
| 567 | right - UnScaleGUI(rect.right)); |
| 568 | |
| 569 | seq.Draw(preferred_x, y, pal, pal == PALETTE_CRASH); |
| 570 | } |
| 571 | } |
| 572 | |
| 573 | /** |
| 574 | * Get the size of the sprite of a train sprite heading west, or both heads (used for lists). |
no test coverage detected