|
@@ -1047,25 +1047,25 @@ struct PerformanceRatingDetailWindow : W
|
|
|
this->DrawWidgets();
|
|
|
}
|
|
|
|
|
|
virtual void DrawWidget(const Rect &r, int widget) const
|
|
|
{
|
|
|
/* No need to draw when there's nothing to draw */
|
|
|
if (this->company == INVALID_COMPANY) return;
|
|
|
|
|
|
if (IsInsideMM(widget, PRW_COMPANY_FIRST, PRW_COMPANY_LAST + 1)) {
|
|
|
if (this->IsWidgetDisabled(widget)) return;
|
|
|
CompanyID cid = (CompanyID)(widget - PRW_COMPANY_FIRST);
|
|
|
int offset = (cid == this->company) ? 1 : 0;
|
|
|
Dimension sprite_size = GetSpriteSize(SPR_PLAYER_ICON);
|
|
|
Dimension sprite_size = GetSpriteSize(SPR_COMPANY_ICON);
|
|
|
DrawCompanyIcon(cid, (r.left + r.right - sprite_size.width) / 2 + offset, (r.top + r.bottom - sprite_size.height) / 2 + offset);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (!IsInsideMM(widget, PRW_SCORE_FIRST, PRW_SCORE_LAST + 1)) return;
|
|
|
|
|
|
ScoreID score_type = (ScoreID)(widget - PRW_SCORE_FIRST);
|
|
|
|
|
|
/* The colours used to show how the progress is going */
|
|
|
int colour_done = _colour_gradient[COLOUR_GREEN][4];
|
|
|
int colour_notdone = _colour_gradient[COLOUR_RED][4];
|
|
|
|
|
@@ -1213,25 +1213,25 @@ static NWidgetBase *MakePerformanceDetai
|
|
|
* Make a number of rows with button-like graphics, for enabling/disabling each company.
|
|
|
* @param biggest_index Storage for collecting the biggest index used in the returned tree.
|
|
|
* @return Panel with rows of company buttons.
|
|
|
* @postcond \c *biggest_index contains the largest used index in the tree.
|
|
|
*/
|
|
|
static NWidgetBase *MakeCompanyButtonRows(int *biggest_index)
|
|
|
{
|
|
|
static const int MAX_LENGTH = 8; // Maximal number of company buttons in one row.
|
|
|
NWidgetVertical *vert = NULL; // Storage for all rows.
|
|
|
NWidgetHorizontal *hor = NULL; // Storage for buttons in one row.
|
|
|
int hor_length = 0;
|
|
|
|
|
|
Dimension sprite_size = GetSpriteSize(SPR_PLAYER_ICON);
|
|
|
Dimension sprite_size = GetSpriteSize(SPR_COMPANY_ICON);
|
|
|
sprite_size.width += WD_MATRIX_LEFT + WD_MATRIX_RIGHT;
|
|
|
sprite_size.height += WD_MATRIX_TOP + WD_MATRIX_BOTTOM + 1; // 1 for the 'offset' of being pressed
|
|
|
|
|
|
for (int widnum = PRW_COMPANY_FIRST; widnum <= PRW_COMPANY_LAST; widnum++) {
|
|
|
/* Ensure there is room in 'hor' for another button. */
|
|
|
if (hor_length == MAX_LENGTH) {
|
|
|
if (vert == NULL) vert = new NWidgetVertical();
|
|
|
vert->Add(hor);
|
|
|
hor = NULL;
|
|
|
hor_length = 0;
|
|
|
}
|
|
|
if (hor == NULL) {
|