equal
deleted
inserted
replaced
36 TTV_RESIZE, |
36 TTV_RESIZE, |
37 }; |
37 }; |
38 |
38 |
39 void SetTimetableParams(int param1, int param2, uint32 time) |
39 void SetTimetableParams(int param1, int param2, uint32 time) |
40 { |
40 { |
41 if (_settings.gui.timetable_in_ticks) { |
41 if (_settings_client.gui.timetable_in_ticks) { |
42 SetDParam(param1, STR_TIMETABLE_TICKS); |
42 SetDParam(param1, STR_TIMETABLE_TICKS); |
43 SetDParam(param2, time); |
43 SetDParam(param2, time); |
44 } else { |
44 } else { |
45 SetDParam(param1, STR_TIMETABLE_DAYS); |
45 SetDParam(param1, STR_TIMETABLE_DAYS); |
46 SetDParam(param2, time / DAY_TICKS); |
46 SetDParam(param2, time / DAY_TICKS); |
170 DrawString(2, y, complete ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE, TC_BLACK); |
170 DrawString(2, y, complete ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE, TC_BLACK); |
171 } |
171 } |
172 } |
172 } |
173 y += 10; |
173 y += 10; |
174 |
174 |
175 if (v->lateness_counter == 0 || (!_settings.gui.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) { |
175 if (v->lateness_counter == 0 || (!_settings_client.gui.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) { |
176 DrawString(2, y, STR_TIMETABLE_STATUS_ON_TIME, TC_BLACK); |
176 DrawString(2, y, STR_TIMETABLE_STATUS_ON_TIME, TC_BLACK); |
177 } else { |
177 } else { |
178 SetTimetableParams(0, 1, abs(v->lateness_counter)); |
178 SetTimetableParams(0, 1, abs(v->lateness_counter)); |
179 DrawString(2, y, v->lateness_counter < 0 ? STR_TIMETABLE_STATUS_EARLY : STR_TIMETABLE_STATUS_LATE, TC_BLACK); |
179 DrawString(2, y, v->lateness_counter < 0 ? STR_TIMETABLE_STATUS_EARLY : STR_TIMETABLE_STATUS_LATE, TC_BLACK); |
180 } |
180 } |
220 const Order *order = GetVehicleOrder(v, real); |
220 const Order *order = GetVehicleOrder(v, real); |
221 StringID current = STR_EMPTY; |
221 StringID current = STR_EMPTY; |
222 |
222 |
223 if (order != NULL) { |
223 if (order != NULL) { |
224 uint time = (selected % 2 == 1) ? order->travel_time : order->wait_time; |
224 uint time = (selected % 2 == 1) ? order->travel_time : order->wait_time; |
225 if (!_settings.gui.timetable_in_ticks) time /= DAY_TICKS; |
225 if (!_settings_client.gui.timetable_in_ticks) time /= DAY_TICKS; |
226 |
226 |
227 if (time != 0) { |
227 if (time != 0) { |
228 SetDParam(0, time); |
228 SetDParam(0, time); |
229 current = STR_CONFIG_PATCHES_INT32; |
229 current = STR_CONFIG_PATCHES_INT32; |
230 } |
230 } |
257 const Vehicle *v = GetVehicle(this->window_number); |
257 const Vehicle *v = GetVehicle(this->window_number); |
258 |
258 |
259 uint32 p1 = PackTimetableArgs(v, this->sel_index); |
259 uint32 p1 = PackTimetableArgs(v, this->sel_index); |
260 |
260 |
261 uint64 time = StrEmpty(str) ? 0 : strtoul(str, NULL, 10); |
261 uint64 time = StrEmpty(str) ? 0 : strtoul(str, NULL, 10); |
262 if (!_settings.gui.timetable_in_ticks) time *= DAY_TICKS; |
262 if (!_settings_client.gui.timetable_in_ticks) time *= DAY_TICKS; |
263 |
263 |
264 uint32 p2 = minu(time, MAX_UVALUE(uint16)); |
264 uint32 p2 = minu(time, MAX_UVALUE(uint16)); |
265 |
265 |
266 DoCommandP(0, p1, p2, NULL, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE)); |
266 DoCommandP(0, p1, p2, NULL, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE)); |
267 } |
267 } |