1
0
Fork 0

(svn r13702) -Fix: do not overflow the order/timetable window when 'long' orders are displayed.

release/0.7
rubidium 2008-07-14 20:18:06 +00:00
parent 9895afb43e
commit be722412fa
4 changed files with 10 additions and 10 deletions

View File

@ -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_8801_CITIZENS_CELEBRATE_FIRST :{BLACK}{BIGFONT}Citizens celebrate . . .{}First train arrives at {STATION}!
STR_8802_DETAILS :{WHITE}{VEHICLE} (Details) STR_8802_DETAILS :{WHITE}{VEHICLE} (Details)
STR_8803_TRAIN_IN_THE_WAY :{WHITE}Train in the way STR_8803_TRAIN_IN_THE_WAY :{WHITE}Train in the way
STR_8804 :{SETX 10}{COMMA}: {STRING4} {STRING2} STR_8804 :{SETX 10}{COMMA}: {SETX 30}{STRING4} {STRING2}
STR_8805 :{RIGHTARROW}{SETX 10}{COMMA}: {STRING4} {STRING2} STR_8805 :{RIGHTARROW}{SETX 10}{COMMA}: {SETX 30}{STRING4} {STRING2}
STR_ORDER_NON_STOP :{BLACK}Non-stop STR_ORDER_NON_STOP :{BLACK}Non-stop
STR_ORDER_GO_TO :Go to STR_ORDER_GO_TO :Go to
STR_ORDER_GO_NON_STOP_TO :Go non-stop 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_NUM :Jump to order {COMMA} when {STRING} {STRING} {COMMA}
STR_CONDITIONAL_TRUE_FALSE :Jump to order {COMMA} when {STRING} {STRING} STR_CONDITIONAL_TRUE_FALSE :Jump to order {COMMA} when {STRING} {STRING}
STR_TIMETABLE_TRAVEL_NOT_TIMETABLED :Travel (not timetabled) STR_TIMETABLE_TRAVEL_NOT_TIMETABLED :{SETX 30}Travel (not timetabled)
STR_TIMETABLE_TRAVEL_FOR :Travel for {STRING1} STR_TIMETABLE_TRAVEL_FOR :{SETX 30}Travel for {STRING1}
STR_TIMETABLE_STAY_FOR :and stay for {STRING1} STR_TIMETABLE_STAY_FOR :and stay for {STRING1}
STR_TIMETABLE_DAYS :{COMMA} day{P "" s} STR_TIMETABLE_DAYS :{COMMA} day{P "" s}
STR_TIMETABLE_TICKS :{COMMA} tick{P "" s} STR_TIMETABLE_TICKS :{COMMA} tick{P "" s}

View File

@ -38,7 +38,7 @@ void CheckOrders(const Vehicle*);
void DeleteVehicleOrders(Vehicle *v); void DeleteVehicleOrders(Vehicle *v);
bool ProcessOrders(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 MIN_SERVINT_PERCENT 5
#define MAX_SERVINT_PERCENT 90 #define MAX_SERVINT_PERCENT 90

View File

@ -162,7 +162,7 @@ extern uint ConvertSpeedToDisplaySpeed(uint speed);
extern uint ConvertDisplaySpeedToSpeed(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; StringID str = (v->cur_order_index == order_index) ? STR_8805 : STR_8804;
SetDParam(6, STR_EMPTY); 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); 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. */ /* Don't draw anything if it extends past the end of the window. */
if (i - this->vscroll.pos >= this->vscroll.cap) break; 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; y += 10;
i++; i++;

View File

@ -124,7 +124,7 @@ struct TimetableWindow : Window {
if (i - this->vscroll.pos >= this->vscroll.cap) break; if (i - this->vscroll.pos >= this->vscroll.cap) break;
if (i % 2 == 0) { 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++; order_id++;
@ -144,7 +144,7 @@ struct TimetableWindow : Window {
string = STR_TIMETABLE_TRAVEL_FOR; 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; if (final_order) break;
} }