Enable bulk timetable change actions for clear time, and set/clear speed.

This commit is contained in:
Jonathan G Rennison
2016-03-20 11:54:57 +00:00
parent aee3b77d99
commit 9f82f00f7a
2 changed files with 9 additions and 8 deletions

View File

@@ -4456,13 +4456,13 @@ STR_TIMETABLE_CHANGE_TIME :{BLACK}Change T
STR_TIMETABLE_WAIT_TIME_TOOLTIP :{BLACK}Change the amount of time that the highlighted order should take (Ctrl+Click sets waiting time for all orders) STR_TIMETABLE_WAIT_TIME_TOOLTIP :{BLACK}Change the amount of time that the highlighted order should take (Ctrl+Click sets waiting time for all orders)
STR_TIMETABLE_CLEAR_TIME :{BLACK}Clear Time STR_TIMETABLE_CLEAR_TIME :{BLACK}Clear Time
STR_TIMETABLE_CLEAR_TIME_TOOLTIP :{BLACK}Clear the amount of time for the highlighted order STR_TIMETABLE_CLEAR_TIME_TOOLTIP :{BLACK}Clear the amount of time for the highlighted order (Ctrl+Click clears the amount of time for all orders)
STR_TIMETABLE_CHANGE_SPEED :{BLACK}Change Speed Limit STR_TIMETABLE_CHANGE_SPEED :{BLACK}Change Speed Limit
STR_TIMETABLE_CHANGE_SPEED_TOOLTIP :{BLACK}Change the maximum travel speed of the highlighted order STR_TIMETABLE_CHANGE_SPEED_TOOLTIP :{BLACK}Change the maximum travel speed of the highlighted order (Ctrl+Click set the speed for all orders)
STR_TIMETABLE_CLEAR_SPEED :{BLACK}Clear Speed Limit STR_TIMETABLE_CLEAR_SPEED :{BLACK}Clear Speed Limit
STR_TIMETABLE_CLEAR_SPEED_TOOLTIP :{BLACK}Clear the maximum travel speed of the highlighted order STR_TIMETABLE_CLEAR_SPEED_TOOLTIP :{BLACK}Clear the maximum travel speed of the highlighted order (Ctrl+Click clears the speed for all orders)
STR_TIMETABLE_RESET_LATENESS :{BLACK}Reset Late Counter STR_TIMETABLE_RESET_LATENESS :{BLACK}Reset Late Counter
STR_TIMETABLE_RESET_LATENESS_TOOLTIP :{BLACK}Reset the lateness counter, so the vehicle will be on time STR_TIMETABLE_RESET_LATENESS_TOOLTIP :{BLACK}Reset the lateness counter, so the vehicle will be on time

View File

@@ -170,7 +170,7 @@ struct TimetableWindow : Window {
Scrollbar *vscroll; Scrollbar *vscroll;
bool query_is_speed_query; ///< The currently open query window is a speed query and not a time query. bool query_is_speed_query; ///< The currently open query window is a speed query and not a time query.
bool set_start_date_all; ///< Set start date using minutes text entry: this is a set all vehicle (ctrl-click) action bool set_start_date_all; ///< Set start date using minutes text entry: this is a set all vehicle (ctrl-click) action
bool set_wait_time_all; ///< Set wait time for all timetable entries (ctrl-click) action bool change_timetable_all; ///< Set wait time or speed for all timetable entries (ctrl-click) action
TimetableWindow(WindowDesc *desc, WindowNumber window_number) : TimetableWindow(WindowDesc *desc, WindowNumber window_number) :
Window(desc), Window(desc),
@@ -602,7 +602,7 @@ struct TimetableWindow : Window {
} }
this->query_is_speed_query = false; this->query_is_speed_query = false;
this->set_wait_time_all = (order != NULL) && (selected % 2 == 0) && _ctrl_pressed; this->change_timetable_all = (order != NULL) && (selected % 2 == 0) && _ctrl_pressed;
ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED); ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED);
break; break;
} }
@@ -623,19 +623,20 @@ struct TimetableWindow : Window {
} }
this->query_is_speed_query = true; this->query_is_speed_query = true;
this->change_timetable_all = (order != NULL) && _ctrl_pressed;
ShowQueryString(current, STR_TIMETABLE_CHANGE_SPEED, 31, this, CS_NUMERAL, QSF_NONE); ShowQueryString(current, STR_TIMETABLE_CHANGE_SPEED, 31, this, CS_NUMERAL, QSF_NONE);
break; break;
} }
case WID_VT_CLEAR_TIME: { // Clear waiting time. case WID_VT_CLEAR_TIME: { // Clear waiting time.
uint32 p1 = PackTimetableArgs(v, this->sel_index, false, true); uint32 p1 = PackTimetableArgs(v, this->sel_index, false, true);
DoCommandP(0, p1, 0, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE)); DoCommandP(0, p1, 0, (_ctrl_pressed ? CMD_BULK_CHANGE_TIMETABLE : CMD_CHANGE_TIMETABLE) | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE));
break; break;
} }
case WID_VT_CLEAR_SPEED: { // Clear max speed button. case WID_VT_CLEAR_SPEED: { // Clear max speed button.
uint32 p1 = PackTimetableArgs(v, this->sel_index, true); uint32 p1 = PackTimetableArgs(v, this->sel_index, true);
DoCommandP(0, p1, UINT16_MAX, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE)); DoCommandP(0, p1, UINT16_MAX, (_ctrl_pressed ? CMD_BULK_CHANGE_TIMETABLE : CMD_CHANGE_TIMETABLE) | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE));
break; break;
} }
@@ -693,7 +694,7 @@ struct TimetableWindow : Window {
uint32 p2 = minu(val, UINT16_MAX); uint32 p2 = minu(val, UINT16_MAX);
DoCommandP(0, p1, p2, (this->set_wait_time_all ? CMD_BULK_CHANGE_TIMETABLE : CMD_CHANGE_TIMETABLE) | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE)); DoCommandP(0, p1, p2, (this->change_timetable_all ? CMD_BULK_CHANGE_TIMETABLE : CMD_CHANGE_TIMETABLE) | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE));
break; break;
} }