(svn r15813) -Codechange: remove the last remnants of the old text drawing API.
This commit is contained in:
@@ -34,16 +34,17 @@
|
||||
* coordinates. If amount exceeds 576 units, it is shown 'full', same
|
||||
* goes for the rating: at above 90% orso (224) it is also 'full'
|
||||
*
|
||||
* @param x coordinate to draw the box at
|
||||
* @param y coordinate to draw the box at
|
||||
* @param type Cargo type
|
||||
* @param left left most coordinate to draw the box at
|
||||
* @param right right most coordinate to draw the box at
|
||||
* @param y coordinate to draw the box at
|
||||
* @param type Cargo type
|
||||
* @param amount Cargo amount
|
||||
* @param rating ratings data for that particular cargo
|
||||
*
|
||||
* @note Each cargo-bar is 16 pixels wide and 6 pixels high
|
||||
* @note Each rating 14 pixels wide and 1 pixel high and is 1 pixel below the cargo-bar
|
||||
*/
|
||||
static void StationsWndShowStationRating(int x, int y, CargoID type, uint amount, byte rating)
|
||||
static void StationsWndShowStationRating(int left, int right, int y, CargoID type, uint amount, byte rating)
|
||||
{
|
||||
static const uint units_full = 576; ///< number of units to show station as 'full'
|
||||
static const uint rating_full = 224; ///< rating needed so it is shown as 'full'
|
||||
@@ -55,25 +56,25 @@ static void StationsWndShowStationRating(int x, int y, CargoID type, uint amount
|
||||
uint w = (minu(amount, units_full) + 5) / 36;
|
||||
|
||||
/* Draw total cargo (limited) on station (fits into 16 pixels) */
|
||||
if (w != 0) GfxFillRect(x, y, x + w - 1, y + 6, colour);
|
||||
if (w != 0) GfxFillRect(left, y, left + w - 1, y + 6, colour);
|
||||
|
||||
/* Draw a one pixel-wide bar of additional cargo meter, useful
|
||||
* for stations with only a small amount (<=30) */
|
||||
if (w == 0) {
|
||||
uint rest = amount / 5;
|
||||
if (rest != 0) {
|
||||
w += x;
|
||||
w += left;
|
||||
GfxFillRect(w, y + 6 - rest, w, y + 6, colour);
|
||||
}
|
||||
}
|
||||
|
||||
DrawString(x + 1, y, cs->abbrev, TC_BLACK);
|
||||
DrawString(left + 1, right, y, cs->abbrev, TC_BLACK);
|
||||
|
||||
/* Draw green/red ratings bar (fits into 14 pixels) */
|
||||
y += 8;
|
||||
GfxFillRect(x + 1, y, x + 14, y, 0xB8);
|
||||
GfxFillRect(left + 1, y, left + 14, y, 0xB8);
|
||||
rating = minu(rating, rating_full) / 16;
|
||||
if (rating != 0) GfxFillRect(x + 1, y, x + rating, y, 0xD0);
|
||||
if (rating != 0) GfxFillRect(left + 1, y, left + rating, y, 0xD0);
|
||||
}
|
||||
|
||||
typedef GUIList<const Station*> GUIStationList;
|
||||
@@ -346,10 +347,10 @@ public:
|
||||
DrawString(x + cg_ofst, x + cg_ofst + 12, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK, SA_CENTER);
|
||||
|
||||
cg_ofst = this->IsWidgetLowered(SLW_FACILALL) ? 2 : 1;
|
||||
DrawString(71 + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK);
|
||||
DrawString(71 + cg_ofst, 71 + cg_ofst + 12, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK);
|
||||
|
||||
if (this->vscroll.count == 0) { // company has no stations
|
||||
DrawString(xb, 40, STR_304A_NONE, TC_FROMSTRING);
|
||||
DrawString(xb, this->width, 40, STR_304A_NONE, TC_FROMSTRING);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -368,12 +369,12 @@ public:
|
||||
|
||||
SetDParam(0, st->index);
|
||||
SetDParam(1, st->facilities);
|
||||
x = DrawString(xb, y, STR_3049_0, TC_FROMSTRING) + 5;
|
||||
x = DrawString(xb, this->widget[SLW_LIST].right, y, STR_3049_0, TC_FROMSTRING) + 5;
|
||||
|
||||
/* show cargo waiting and station ratings */
|
||||
for (CargoID j = 0; j < NUM_CARGO; j++) {
|
||||
if (!st->goods[j].cargo.Empty()) {
|
||||
StationsWndShowStationRating(x, y, j, st->goods[j].cargo.Count(), st->goods[j].rating);
|
||||
StationsWndShowStationRating(x, this->widget[SLW_LIST].right, y, j, st->goods[j].cargo.Count(), st->goods[j].rating);
|
||||
x += 20;
|
||||
}
|
||||
}
|
||||
@@ -802,7 +803,7 @@ struct StationViewWindow : public Window {
|
||||
if (!st->goods[i].cargo.Empty()) str = STR_EMPTY;
|
||||
}
|
||||
SetDParam(0, str);
|
||||
DrawString(x, y, STR_0008_WAITING, TC_FROMSTRING);
|
||||
DrawString(x, this->widget[SVW_WAITING].right - 2, y, STR_0008_WAITING, TC_FROMSTRING);
|
||||
y += 10;
|
||||
}
|
||||
|
||||
@@ -867,7 +868,7 @@ struct StationViewWindow : public Window {
|
||||
} else { // extended window with list of cargo ratings
|
||||
y = this->widget[SVW_RATINGLIST].top + 1;
|
||||
|
||||
DrawString(2, y, STR_3034_LOCAL_RATING_OF_TRANSPORT, TC_FROMSTRING);
|
||||
DrawString(this->widget[SVW_ACCEPTLIST].left + 2, this->widget[SVW_ACCEPTLIST].right - 2, y, STR_3034_LOCAL_RATING_OF_TRANSPORT, TC_FROMSTRING);
|
||||
y += 10;
|
||||
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
@@ -880,7 +881,7 @@ struct StationViewWindow : public Window {
|
||||
SetDParam(0, cs->name);
|
||||
SetDParam(2, ge->rating * 101 >> 8);
|
||||
SetDParam(1, STR_3035_APPALLING + (ge->rating >> 5));
|
||||
DrawString(8, y, STR_303D, TC_FROMSTRING);
|
||||
DrawString(this->widget[SVW_ACCEPTLIST].left + 8, this->widget[SVW_ACCEPTLIST].right - 2, y, STR_303D, TC_FROMSTRING);
|
||||
y += 10;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user