-
-
Save Wolfolo/9ed1d44e0ab16d769cc4f4e3528b9da3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp | |
index 47eefc6..b9ba461 100644 | |
--- a/src/depot_gui.cpp | |
+++ b/src/depot_gui.cpp | |
@@ -297,9 +297,9 @@ struct DepotWindow : Window { | |
this->sel, EIT_IN_DEPOT, free_wagon ? 0 : this->hscroll->GetPosition(), this->vehicle_over); | |
/* Length of consist in tiles with 1 fractional digit (rounded up) */ | |
- SetDParam(0, CeilDiv(u->gcache.cached_total_length * 10, TILE_SIZE)); | |
- SetDParam(1, 1); | |
- DrawString(rtl ? left + WD_FRAMERECT_LEFT : right - this->count_width, rtl ? left + this->count_width : right - WD_FRAMERECT_RIGHT, y + (this->resize.step_height - FONT_HEIGHT_SMALL) / 2, STR_TINY_BLACK_DECIMAL, TC_FROMSTRING, SA_RIGHT); // Draw the counter | |
+ //SetDParam(0, CeilDiv(u->gcache.cached_total_length * 10, TILE_SIZE)); | |
+ //SetDParam(1, 1); | |
+ //DrawString(rtl ? left + WD_FRAMERECT_LEFT : right - this->count_width, rtl ? left + this->count_width : right - WD_FRAMERECT_RIGHT, y + (this->resize.step_height - FONT_HEIGHT_SMALL) / 2, STR_TINY_BLACK_DECIMAL, TC_FROMSTRING, SA_RIGHT); // Draw the counter | |
break; | |
} | |
@@ -332,6 +332,22 @@ struct DepotWindow : Window { | |
} | |
} | |
+ void DrawTrainLengthCounter(const Rect &r) const | |
+ { | |
+ if (this->type != VEH_TRAIN) return; | |
+ | |
+ bool rtl = _current_text_dir == TD_RTL; | |
+ int column = 0; | |
+ | |
+ for (int w = r.left + this->header_width - this->hscroll->GetPosition(); w <= r.right + this->hscroll->GetPosition(); w += TRAININFO_DEFAULT_VEHICLE_WIDTH * 2) { | |
+ GfxDrawLine(w, r.top, w, r.bottom, 7, 1, 1); | |
+ | |
+ SetDParam(0, column++); | |
+ | |
+ DrawString(rtl ? left + WD_FRAMERECT_LEFT : w - this->count_width, rtl ? w + this->count_width : w - WD_FRAMERECT_RIGHT, r.bottom - (this->resize.step_height - FONT_HEIGHT_SMALL) / 2, STR_TINY_GRAY, TC_FROMSTRING, SA_RIGHT); // Draw the tile counter | |
+ } | |
+ } | |
+ | |
void DrawWidget(const Rect &r, int widget) const | |
{ | |
if (widget != WID_D_MATRIX) return; | |
@@ -342,6 +358,8 @@ struct DepotWindow : Window { | |
const NWidgetCore *wid = this->GetWidget<NWidgetCore>(WID_D_MATRIX); | |
uint16 rows_in_display = wid->current_y / wid->resize_y; | |
+ this->DrawTrainLengthCounter(r); | |
+ | |
uint16 num = this->vscroll->GetPosition() * this->num_columns; | |
int maxval = min(this->vehicle_list.Length(), num + (rows_in_display * this->num_columns)); | |
int y; | |
diff --git a/src/lang/english.txt b/src/lang/english.txt | |
index 5d79448..0c11780 100644 | |
--- a/src/lang/english.txt | |
+++ b/src/lang/english.txt | |
@@ -4966,6 +4966,7 @@ STR_ORANGE_STRING1_LTBLUE :{ORANGE}{STRING | |
STR_TINY_BLACK_HEIGHT :{TINY_FONT}{BLACK}{HEIGHT} | |
STR_TINY_BLACK_VEHICLE :{TINY_FONT}{BLACK}{VEHICLE} | |
STR_TINY_RIGHT_ARROW :{TINY_FONT}{RIGHT_ARROW} | |
+STR_TINY_GRAY :{TINY_FONT}{GRAY}{NUM} | |
STR_BLACK_1 :{BLACK}1 | |
STR_BLACK_2 :{BLACK}2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment