|
@@ -1165,49 +1165,49 @@ void ViewportSign::UpdatePosition(int ce
|
|
|
|
|
|
this->top = top;
|
|
|
|
|
|
char buffer[DRAW_STRING_BUFFER];
|
|
|
|
|
|
GetString(buffer, str, lastof(buffer));
|
|
|
this->width_normal = VPSM_LEFT + Align(GetStringBoundingBox(buffer).width, 2) + VPSM_RIGHT;
|
|
|
this->center = center;
|
|
|
|
|
|
/* zoomed out version */
|
|
|
_cur_fontsize = FS_SMALL;
|
|
|
this->width_small = VPSM_LEFT + Align(GetStringBoundingBox(buffer).width, 2) + VPSM_RIGHT;
|
|
|
_cur_fontsize = FS_NORMAL;
|
|
|
|
|
|
this->MarkDirty();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Mark the sign dirty in all viewports.
|
|
|
*
|
|
|
* @ingroup dirty
|
|
|
*/
|
|
|
void ViewportSign::MarkDirty() const
|
|
|
{
|
|
|
/* We use ZOOM_LVL_MAX here, as every viewport can have an other zoom,
|
|
|
/* We use ZOOM_LVL_MAX here, as every viewport can have another zoom,
|
|
|
* and there is no way for us to know which is the biggest. So make the
|
|
|
* biggest area dirty, and we are safe for sure.
|
|
|
* We also add 1 to make sure the whole thing is redrawn. */
|
|
|
MarkAllViewportsDirty(
|
|
|
this->center - ScaleByZoom(this->width_normal / 2 + 1, ZOOM_LVL_MAX),
|
|
|
this->top - ScaleByZoom(1, ZOOM_LVL_MAX),
|
|
|
this->center + ScaleByZoom(this->width_normal / 2 + 1, ZOOM_LVL_MAX),
|
|
|
this->top + ScaleByZoom(VPSM_TOP + FONT_HEIGHT_NORMAL + VPSM_BOTTOM + 1, ZOOM_LVL_MAX));
|
|
|
}
|
|
|
|
|
|
static void ViewportDrawTileSprites(const TileSpriteToDrawVector *tstdv)
|
|
|
{
|
|
|
const TileSpriteToDraw *tsend = tstdv->End();
|
|
|
for (const TileSpriteToDraw *ts = tstdv->Begin(); ts != tsend; ++ts) {
|
|
|
DrawSprite(ts->image, ts->pal, ts->x, ts->y, ts->sub);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/** Sort parent sprites pointer array */
|
|
|
static void ViewportSortParentSprites(ParentSpriteToSortVector *psdv)
|
|
|
{
|
|
|
ParentSpriteToDraw **psdvend = psdv->End();
|
|
|
ParentSpriteToDraw **psd = psdv->Begin();
|
|
|
while (psd != psdvend) {
|