1
0
Fork 0

Compare commits

..

No commits in common. "6f7153bf71b088a3ebb5cab3a3e1919903744b6d" and "cb8612ba79fc3da00bb8d41f817889942f98f270" have entirely different histories.

5 changed files with 11 additions and 20 deletions

View File

@ -451,21 +451,6 @@ void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3)
GfxDrawLineUnscaled(x + dx3, y + dy3, x + dx3 + dx2, y + dy3 + dy2, colour);
}
/**
* Draw the outline of a Rect
* @param r Rect to draw.
* @param colour Colour of the outline.
* @param width Width of the outline.
* @param dash Length of dashes for dashed lines. 0 means solid lines.
*/
void DrawRectOutline(const Rect &r, int colour, int width, int dash)
{
GfxDrawLine(r.left, r.top, r.right, r.top, colour, width, dash);
GfxDrawLine(r.left, r.top, r.left, r.bottom, colour, width, dash);
GfxDrawLine(r.right, r.top, r.right, r.bottom, colour, width, dash);
GfxDrawLine(r.left, r.bottom, r.right, r.bottom, colour, width, dash);
}
/**
* Set the colour remap to be for the given colour.
* @param colour the new colour of the remap.

View File

@ -103,7 +103,6 @@ void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectM
void GfxFillPolygon(const std::vector<Point> &shape, int colour, FillRectMode mode = FILLRECT_OPAQUE);
void GfxDrawLine(int left, int top, int right, int bottom, int colour, int width = 1, int dash = 0);
void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3);
void DrawRectOutline(const Rect &r, int colour, int width = 1, int dash = 0);
/* Versions of DrawString/DrawStringMultiLine that accept a Rect instead of separate left, right, top and bottom parameters. */
static inline int DrawString(const Rect &r, std::string_view str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false, FontSize fontsize = FS_NORMAL)

View File

@ -2146,7 +2146,10 @@ struct CargoesField {
int ypos1 = ypos + vert_inter_industry_space / 2;
int ypos2 = ypos + normal_height - 1 - vert_inter_industry_space / 2;
int xpos2 = xpos + industry_width - 1;
DrawRectOutline({xpos, ypos1, xpos2, ypos2}, INDUSTRY_LINE_COLOUR);
GfxDrawLine(xpos, ypos1, xpos2, ypos1, INDUSTRY_LINE_COLOUR);
GfxDrawLine(xpos, ypos1, xpos, ypos2, INDUSTRY_LINE_COLOUR);
GfxDrawLine(xpos, ypos2, xpos2, ypos2, INDUSTRY_LINE_COLOUR);
GfxDrawLine(xpos2, ypos1, xpos2, ypos2, INDUSTRY_LINE_COLOUR);
ypos += (normal_height - GetCharacterHeight(FS_NORMAL)) / 2;
if (this->u.industry.ind_type < NUM_INDUSTRYTYPES) {
const IndustrySpec *indsp = GetIndustrySpec(this->u.industry.ind_type);

View File

@ -129,7 +129,7 @@ public:
*/
StringParameters GetRemainingParameters(size_t offset)
{
return StringParameters(this->parameters.subspan(offset, this->parameters.size() - offset));
return StringParameters(this->parameters.subspan(offset, GetDataLeft()));
}
/** Return the amount of elements which can still be read. */

View File

@ -922,11 +922,15 @@ int Window::SortButtonWidth()
bool _draw_widget_outlines;
static void DrawOutline(const Window *, const NWidgetBase *wid)
void DrawOutline(const Window *, const NWidgetBase *wid)
{
if (!_draw_widget_outlines || wid->current_x == 0 || wid->current_y == 0) return;
DrawRectOutline(wid->GetCurrentRect(), PC_WHITE, 1, 4);
Rect r = wid->GetCurrentRect();
GfxDrawLine(r.left, r.top, r.right, r.top, PC_WHITE, 1, 4);
GfxDrawLine(r.left, r.top, r.left, r.bottom, PC_WHITE, 1, 4);
GfxDrawLine(r.right, r.top, r.right, r.bottom, PC_WHITE, 1, 4);
GfxDrawLine(r.left, r.bottom, r.right, r.bottom, PC_WHITE, 1, 4);
}
/**