* Draw icons of waiting cargo. * @param cargo type of cargo * @param waiting number of waiting units * @param r Rect to draw within */
| 1771 | * @param r Rect to draw within |
| 1772 | */ |
| 1773 | void DrawCargoIcons(CargoType cargo, uint waiting, const Rect &r) const |
| 1774 | { |
| 1775 | int width = ScaleSpriteTrad(10); |
| 1776 | uint num = std::min<uint>((waiting + (width / 2)) / width, r.Width() / width); // maximum is width / 10 icons so it won't overflow |
| 1777 | if (num == 0) return; |
| 1778 | |
| 1779 | SpriteID sprite = CargoSpec::Get(cargo)->GetCargoIcon(); |
| 1780 | |
| 1781 | int x = _current_text_dir == TD_RTL ? r.left : r.right - num * width; |
| 1782 | int y = CentreBounds(r.top, r.bottom, this->cargo_icon_size.height); |
| 1783 | do { |
| 1784 | DrawSprite(sprite, PAL_NONE, x, y); |
| 1785 | x += width; |
| 1786 | } while (--num); |
| 1787 | } |
| 1788 | |
| 1789 | /** |
| 1790 | * Draw the given cargo entries in the station GUI. |
no test coverage detected