diff options
author | fonsinchen <fonsinchen@openttd.org> | 2014-05-01 14:53:06 +0000 |
---|---|---|
committer | fonsinchen <fonsinchen@openttd.org> | 2014-05-01 14:53:06 +0000 |
commit | 64e4e52c3342a459dd2ee96fb0b9b165edaafb96 (patch) | |
tree | 4c4f1b67a87a61e0350bccf085f098b3ade700dd | |
parent | 11d98f043e96b7b7d9a2f97b5a7297b641f97c26 (diff) | |
download | openttd-64e4e52c3342a459dd2ee96fb0b9b165edaafb96.tar.xz |
(svn r26550) -Change: Show measured order times in timetable GUI
-rw-r--r-- | src/lang/english.txt | 6 | ||||
-rw-r--r-- | src/order_gui.cpp | 8 | ||||
-rw-r--r-- | src/timetable_cmd.cpp | 20 | ||||
-rw-r--r-- | src/timetable_gui.cpp | 17 |
4 files changed, 34 insertions, 17 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt index fb21483ce..093d381c9 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3795,9 +3795,13 @@ STR_TIMETABLE_TOOLTIP :{BLACK}Timetabl STR_TIMETABLE_NO_TRAVEL :No travel STR_TIMETABLE_NOT_TIMETABLEABLE :Travel (automatic; timetabled by next manual order) STR_TIMETABLE_TRAVEL_NOT_TIMETABLED :Travel (not timetabled) -STR_TIMETABLE_TRAVEL_NOT_TIMETABLED_SPEED :Travel with at most {2:VELOCITY} (not timetabled) +STR_TIMETABLE_TRAVEL_NOT_TIMETABLED_SPEED :Travel (not timetabled) with at most {2:VELOCITY} STR_TIMETABLE_TRAVEL_FOR :Travel for {STRING1} STR_TIMETABLE_TRAVEL_FOR_SPEED :Travel for {STRING1} with at most {VELOCITY} +STR_TIMETABLE_TRAVEL_FOR_ESTIMATED :Travel (for {STRING1}, not timetabled) +STR_TIMETABLE_TRAVEL_FOR_SPEED_ESTIMATED :Travel (for {STRING1}, not timetabled) with at most {VELOCITY} +STR_TIMETABLE_STAY_FOR_ESTIMATED :(stay for {STRING1}, not timetabled) +STR_TIMETABLE_AND_TRAVEL_FOR_ESTIMATED :(travel for {STRING1}, not timetabled) STR_TIMETABLE_STAY_FOR :and stay for {STRING1} STR_TIMETABLE_AND_TRAVEL_FOR :and travel for {STRING1} STR_TIMETABLE_DAYS :{COMMA} day{P "" s} diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 2a3007080..e69f229f0 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -266,8 +266,8 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int if (timetable) { SetDParam(3, STR_EMPTY); - if (order->IsWaitTimetabled()) { - SetDParam(5, STR_TIMETABLE_STAY_FOR); + if (order->GetWaitTime() > 0) { + SetDParam(5, order->IsWaitTimetabled() ? STR_TIMETABLE_STAY_FOR : STR_TIMETABLE_STAY_FOR_ESTIMATED); SetTimetableParams(6, 7, order->GetWaitTime()); } } else { @@ -334,8 +334,8 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int SetDParam(4, value); } - if (timetable && order->IsWaitTimetabled()) { - SetDParam(5, STR_TIMETABLE_AND_TRAVEL_FOR); + if (timetable && order->GetWaitTime() > 0) { + SetDParam(5, order->IsWaitTimetabled() ? STR_TIMETABLE_AND_TRAVEL_FOR : STR_TIMETABLE_AND_TRAVEL_FOR_ESTIMATED); SetTimetableParams(6, 7, order->GetWaitTime()); } else { SetDParam(5, STR_EMPTY); diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp index 34990e3f6..d899b7561 100644 --- a/src/timetable_cmd.cpp +++ b/src/timetable_cmd.cpp @@ -116,8 +116,8 @@ CommandCost CmdChangeTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, u ModifyTimetableFlags mtf = Extract<ModifyTimetableFlags, 28, 2>(p1); if (mtf >= MTF_END) return CMD_ERROR; - int wait_time = order->GetTimetabledWait(); - int travel_time = order->GetTimetabledTravel(); + int wait_time = order->GetWaitTime(); + int travel_time = order->GetTravelTime(); int max_speed = order->GetMaxSpeed(); switch (mtf) { case MTF_WAIT_TIME: @@ -137,7 +137,7 @@ CommandCost CmdChangeTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, u NOT_REACHED(); } - if (wait_time != order->GetTimetabledWait()) { + if (wait_time != order->GetWaitTime()) { switch (order->GetType()) { case OT_GOTO_STATION: if (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) return_cmd_error(STR_ERROR_TIMETABLE_NOT_STOPPING_HERE); @@ -150,13 +150,19 @@ CommandCost CmdChangeTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, u } } - if (travel_time != order->GetTimetabledTravel() && order->IsType(OT_CONDITIONAL)) return CMD_ERROR; + if (travel_time != order->GetTravelTime() && order->IsType(OT_CONDITIONAL)) return CMD_ERROR; if (max_speed != order->GetMaxSpeed() && (order->IsType(OT_CONDITIONAL) || v->type == VEH_AIRCRAFT)) return CMD_ERROR; if (flags & DC_EXEC) { - if (wait_time != order->GetTimetabledWait()) ChangeTimetable(v, order_number, wait_time, MTF_WAIT_TIME, wait_time > 0); - if (travel_time != order->GetTimetabledTravel()) ChangeTimetable(v, order_number, travel_time, MTF_TRAVEL_TIME, travel_time > 0); - if (max_speed != order->GetMaxSpeed()) ChangeTimetable(v, order_number, max_speed, MTF_TRAVEL_SPEED, max_speed != UINT16_MAX); + if (wait_time != order->GetWaitTime() || (wait_time > 0 && !order->IsWaitTimetabled())) { + ChangeTimetable(v, order_number, wait_time, MTF_WAIT_TIME, wait_time > 0); + } + if (travel_time != order->GetTravelTime() || (travel_time > 0 && !order->IsTravelTimetabled())) { + ChangeTimetable(v, order_number, travel_time, MTF_TRAVEL_TIME, travel_time > 0); + } + if (max_speed != order->GetMaxSpeed()) { + ChangeTimetable(v, order_number, max_speed, MTF_TRAVEL_SPEED, max_speed != UINT16_MAX); + } } return CommandCost(); diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index cd0125255..2c6a22c5d 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -402,9 +402,16 @@ struct TimetableWindow : Window { string = STR_TIMETABLE_NOT_TIMETABLEABLE; colour = ((i == selected) ? TC_SILVER : TC_GREY) | TC_NO_SHADE; } else if (!order->IsTravelTimetabled()) { - string = order->GetMaxSpeed() != UINT16_MAX ? - STR_TIMETABLE_TRAVEL_NOT_TIMETABLED_SPEED : - STR_TIMETABLE_TRAVEL_NOT_TIMETABLED; + if (order->GetTravelTime() > 0) { + SetTimetableParams(0, 1, order->GetTravelTime()); + string = order->GetMaxSpeed() != UINT16_MAX ? + STR_TIMETABLE_TRAVEL_FOR_SPEED_ESTIMATED : + STR_TIMETABLE_TRAVEL_FOR_ESTIMATED; + } else { + string = order->GetMaxSpeed() != UINT16_MAX ? + STR_TIMETABLE_TRAVEL_NOT_TIMETABLED_SPEED : + STR_TIMETABLE_TRAVEL_NOT_TIMETABLED; + } } else { SetTimetableParams(0, 1, order->GetTimetabledTravel()); string = order->GetMaxSpeed() != UINT16_MAX ? @@ -546,7 +553,7 @@ struct TimetableWindow : Window { StringID current = STR_EMPTY; if (order != NULL) { - uint time = (selected % 2 == 1) ? order->GetTimetabledTravel() : order->GetTimetabledWait(); + uint time = (selected % 2 == 1) ? order->GetTravelTime() : order->GetWaitTime(); if (!_settings_client.gui.timetable_in_ticks) time /= DAY_TICKS; if (time != 0) { @@ -556,7 +563,7 @@ struct TimetableWindow : Window { } this->query_is_speed_query = false; - ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED); break; } |