(svn r26546) -Codechange: Make order wait_time, travel_time and max_speed private
This commit is contained in:
@@ -78,9 +78,12 @@ static bool CanDetermineTimeTaken(const Order *order, bool travelling)
|
||||
/* Current order is conditional */
|
||||
if (order->IsType(OT_CONDITIONAL) || order->IsType(OT_IMPLICIT)) return false;
|
||||
/* No travel time and we have not already finished travelling */
|
||||
if (travelling && order->travel_time == 0) return false;
|
||||
if (travelling && order->GetTravelTime() == 0) return false;
|
||||
/* No wait time but we are loading at this timetabled station */
|
||||
if (!travelling && order->wait_time == 0 && order->IsType(OT_GOTO_STATION) && !(order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) return false;
|
||||
if (!travelling && order->GetWaitTime() == 0 && order->IsType(OT_GOTO_STATION) &&
|
||||
!(order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -118,12 +121,12 @@ static void FillTimetableArrivalDepartureTable(const Vehicle *v, VehicleOrderID
|
||||
if (!order->IsType(OT_IMPLICIT)) {
|
||||
if (travelling || i != start) {
|
||||
if (!CanDetermineTimeTaken(order, true)) return;
|
||||
sum += order->travel_time;
|
||||
sum += order->GetTravelTime();
|
||||
table[i].arrival = sum;
|
||||
}
|
||||
|
||||
if (!CanDetermineTimeTaken(order, false)) return;
|
||||
sum += order->wait_time;
|
||||
sum += order->GetWaitTime();
|
||||
table[i].departure = sum;
|
||||
}
|
||||
|
||||
@@ -140,7 +143,7 @@ static void FillTimetableArrivalDepartureTable(const Vehicle *v, VehicleOrderID
|
||||
* travelling part of the first order. */
|
||||
if (!travelling) {
|
||||
if (!CanDetermineTimeTaken(order, true)) return;
|
||||
sum += order->travel_time;
|
||||
sum += order->GetTravelTime();
|
||||
table[i].arrival = sum;
|
||||
}
|
||||
}
|
||||
@@ -398,13 +401,16 @@ struct TimetableWindow : Window {
|
||||
} else if (order->IsType(OT_IMPLICIT)) {
|
||||
string = STR_TIMETABLE_NOT_TIMETABLEABLE;
|
||||
colour = ((i == selected) ? TC_SILVER : TC_GREY) | TC_NO_SHADE;
|
||||
} else if (order->travel_time == 0) {
|
||||
string = order->max_speed != UINT16_MAX ? STR_TIMETABLE_TRAVEL_NOT_TIMETABLED_SPEED : STR_TIMETABLE_TRAVEL_NOT_TIMETABLED;
|
||||
} else if (order->GetTravelTime() == 0) {
|
||||
string = order->GetMaxSpeed() != UINT16_MAX ?
|
||||
STR_TIMETABLE_TRAVEL_NOT_TIMETABLED_SPEED :
|
||||
STR_TIMETABLE_TRAVEL_NOT_TIMETABLED;
|
||||
} else {
|
||||
SetTimetableParams(0, 1, order->travel_time);
|
||||
string = order->max_speed != UINT16_MAX ? STR_TIMETABLE_TRAVEL_FOR_SPEED : STR_TIMETABLE_TRAVEL_FOR;
|
||||
SetTimetableParams(0, 1, order->GetTravelTime());
|
||||
string = order->GetMaxSpeed() != UINT16_MAX ?
|
||||
STR_TIMETABLE_TRAVEL_FOR_SPEED : STR_TIMETABLE_TRAVEL_FOR;
|
||||
}
|
||||
SetDParam(2, order->max_speed);
|
||||
SetDParam(2, order->GetMaxSpeed());
|
||||
|
||||
DrawString(rtl ? r.left + WD_FRAMERECT_LEFT : middle, rtl ? middle : r.right - WD_FRAMERECT_LEFT, y, string, colour);
|
||||
|
||||
@@ -540,7 +546,7 @@ struct TimetableWindow : Window {
|
||||
StringID current = STR_EMPTY;
|
||||
|
||||
if (order != NULL) {
|
||||
uint time = (selected % 2 == 1) ? order->travel_time : order->wait_time;
|
||||
uint time = (selected % 2 == 1) ? order->GetTravelTime() : order->GetWaitTime();
|
||||
if (!_settings_client.gui.timetable_in_ticks) time /= DAY_TICKS;
|
||||
|
||||
if (time != 0) {
|
||||
@@ -563,8 +569,8 @@ struct TimetableWindow : Window {
|
||||
StringID current = STR_EMPTY;
|
||||
const Order *order = v->GetOrder(real);
|
||||
if (order != NULL) {
|
||||
if (order->max_speed != UINT16_MAX) {
|
||||
SetDParam(0, ConvertKmhishSpeedToDisplaySpeed(order->max_speed));
|
||||
if (order->GetMaxSpeed() != UINT16_MAX) {
|
||||
SetDParam(0, ConvertKmhishSpeedToDisplaySpeed(order->GetMaxSpeed()));
|
||||
current = STR_JUST_INT;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user