From be722412facf7815181529e503d1262542517431 Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 14 Jul 2008 20:18:06 +0000 Subject: (svn r13702) -Fix: do not overflow the order/timetable window when 'long' orders are displayed. --- src/lang/english.txt | 8 ++++---- src/order_func.h | 2 +- src/order_gui.cpp | 6 +++--- src/timetable_gui.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/lang/english.txt b/src/lang/english.txt index 26b9273d8..92f3a8121 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2664,8 +2664,8 @@ STR_8800_TRAIN_DEPOT :{WHITE}{TOWN} T STR_8801_CITIZENS_CELEBRATE_FIRST :{BLACK}{BIGFONT}Citizens celebrate . . .{}First train arrives at {STATION}! STR_8802_DETAILS :{WHITE}{VEHICLE} (Details) STR_8803_TRAIN_IN_THE_WAY :{WHITE}Train in the way -STR_8804 :{SETX 10}{COMMA}: {STRING4} {STRING2} -STR_8805 :{RIGHTARROW}{SETX 10}{COMMA}: {STRING4} {STRING2} +STR_8804 :{SETX 10}{COMMA}: {SETX 30}{STRING4} {STRING2} +STR_8805 :{RIGHTARROW}{SETX 10}{COMMA}: {SETX 30}{STRING4} {STRING2} STR_ORDER_NON_STOP :{BLACK}Non-stop STR_ORDER_GO_TO :Go to STR_ORDER_GO_NON_STOP_TO :Go non-stop to @@ -2738,8 +2738,8 @@ STR_CONDITIONAL_UNCONDITIONAL :Jump to order { STR_CONDITIONAL_NUM :Jump to order {COMMA} when {STRING} {STRING} {COMMA} STR_CONDITIONAL_TRUE_FALSE :Jump to order {COMMA} when {STRING} {STRING} -STR_TIMETABLE_TRAVEL_NOT_TIMETABLED :Travel (not timetabled) -STR_TIMETABLE_TRAVEL_FOR :Travel for {STRING1} +STR_TIMETABLE_TRAVEL_NOT_TIMETABLED :{SETX 30}Travel (not timetabled) +STR_TIMETABLE_TRAVEL_FOR :{SETX 30}Travel for {STRING1} STR_TIMETABLE_STAY_FOR :and stay for {STRING1} STR_TIMETABLE_DAYS :{COMMA} day{P "" s} STR_TIMETABLE_TICKS :{COMMA} tick{P "" s} diff --git a/src/order_func.h b/src/order_func.h index 8d145da93..be2ceea11 100644 --- a/src/order_func.h +++ b/src/order_func.h @@ -38,7 +38,7 @@ void CheckOrders(const Vehicle*); void DeleteVehicleOrders(Vehicle *v); bool ProcessOrders(Vehicle *v); -void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable); +void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int width); #define MIN_SERVINT_PERCENT 5 #define MAX_SERVINT_PERCENT 90 diff --git a/src/order_gui.cpp b/src/order_gui.cpp index ca28ffb9a..c2ed05d8a 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -162,7 +162,7 @@ extern uint ConvertSpeedToDisplaySpeed(uint speed); extern uint ConvertDisplaySpeedToSpeed(uint speed); -void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable) +void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int width) { StringID str = (v->cur_order_index == order_index) ? STR_8805 : STR_8804; SetDParam(6, STR_EMPTY); @@ -257,7 +257,7 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int } SetDParam(0, order_index + 1); - DrawString(2, y, str, selected ? TC_WHITE : TC_BLACK); + DrawStringTruncated(2, y, str, selected ? TC_WHITE : TC_BLACK, width); } @@ -734,7 +734,7 @@ public: /* Don't draw anything if it extends past the end of the window. */ if (i - this->vscroll.pos >= this->vscroll.cap) break; - DrawOrderString(this->vehicle, order, i, y, i == this->selected_order, false); + DrawOrderString(this->vehicle, order, i, y, i == this->selected_order, false, this->widget[ORDER_WIDGET_ORDER_LIST].right - 4); y += 10; i++; diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 3f255c1aa..14bb663ea 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -124,7 +124,7 @@ struct TimetableWindow : Window { if (i - this->vscroll.pos >= this->vscroll.cap) break; if (i % 2 == 0) { - DrawOrderString(v, order, order_id, y, i == selected, true); + DrawOrderString(v, order, order_id, y, i == selected, true, this->widget[TTV_TIMETABLE_PANEL].right - 4); order_id++; @@ -144,7 +144,7 @@ struct TimetableWindow : Window { string = STR_TIMETABLE_TRAVEL_FOR; } - DrawString(22, y, string, (i == selected) ? TC_WHITE : TC_BLACK); + DrawStringTruncated(2, y, string, (i == selected) ? TC_WHITE : TC_BLACK, this->widget[TTV_TIMETABLE_PANEL].right - 4); if (final_order) break; } -- cgit v1.2.3-54-g00ecf