(svn r21642) -Feature: concept of automatic station orders; add stub orders for intermediate stations and remove them when not visiting them anymore. This allows you to see what trains visit a station without actually having to order a vehicle to stop at all stations. Based on patch by fonsinchen

This commit is contained in:
rubidium
2010-12-26 09:03:19 +00:00
parent 8a278f7711
commit 64f04c3a74
10 changed files with 123 additions and 27 deletions

View File

@@ -72,7 +72,7 @@ CommandCost CmdChangeTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, u
VehicleOrderID order_number = GB(p1, 20, 8);
Order *order = v->GetOrder(order_number);
if (order == NULL) return CMD_ERROR;
if (order == NULL || order->IsType(OT_AUTOMATIC)) return CMD_ERROR;
bool is_journey = HasBit(p1, 28);
@@ -238,11 +238,17 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
v->current_order_time = 0;
if (!_settings_game.order.timetabling) return;
if (v->current_order.IsType(OT_AUTOMATIC)) return; // no timetabling of auto orders
VehicleOrderID first_manual_order = 0;
for (Order *o = v->GetFirstOrder(); o != NULL && o->IsType(OT_AUTOMATIC); o = o->next) {
++first_manual_order;
}
bool just_started = false;
/* This vehicle is arriving at the first destination in the timetable. */
if (v->cur_order_index == 0 && travelling) {
if (v->cur_order_index == first_manual_order && travelling) {
/* If the start date hasn't been set, or it was set automatically when
* the vehicle last arrived at the first destination, update it to the
* current time. Otherwise set the late counter appropriately to when
@@ -279,7 +285,7 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
ChangeTimetable(v, v->cur_order_index, time_taken, travelling);
}
if (v->cur_order_index == 0 && travelling) {
if (v->cur_order_index == first_manual_order && travelling) {
/* If we just started we would have returned earlier and have not reached
* this code. So obviously, we have completed our round: So turn autofill
* off again. */