* Adds town names to the smallmap. * @param dpi the part of the smallmap to be drawn into */
| 986 | * @param dpi the part of the smallmap to be drawn into |
| 987 | */ |
| 988 | void DrawTowns(const DrawPixelInfo *dpi, const int vertical_padding) const |
| 989 | { |
| 990 | for (const Town *t : Town::Iterate()) { |
| 991 | /* Remap the town coordinate */ |
| 992 | Point pt = this->RemapTile(TileX(t->xy), TileY(t->xy)); |
| 993 | int x = pt.x - this->subscroll - (t->cache.sign.width_small >> 1); |
| 994 | int y = pt.y + vertical_padding; |
| 995 | |
| 996 | /* Check if the town sign is within bounds */ |
| 997 | if (x + t->cache.sign.width_small > dpi->left && |
| 998 | x < dpi->left + dpi->width && |
| 999 | y + GetCharacterHeight(FS_SMALL) > dpi->top && |
| 1000 | y < dpi->top + dpi->height) { |
| 1001 | /* And draw it. */ |
| 1002 | DrawString(x, x + t->cache.sign.width_small, y, GetString(STR_SMALLMAP_TOWN, t->index)); |
| 1003 | } |
| 1004 | } |
| 1005 | } |
| 1006 | |
| 1007 | /** |
| 1008 | * Adds industry names to the smallmap. |
no test coverage detected