2378 case OT_GOTO_DEPOT: |
2379 case OT_GOTO_DEPOT: |
2379 if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return false; |
2380 if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return false; |
2380 if ((v->current_order.flags & OF_SERVICE_IF_NEEDED) && |
2381 if ((v->current_order.flags & OF_SERVICE_IF_NEEDED) && |
2381 !VehicleNeedsService(v)) { |
2382 !VehicleNeedsService(v)) { |
2382 v->cur_order_index++; |
2383 v->cur_order_index++; |
|
2384 UpdateVehicleTimetable(v, true); |
2383 } |
2385 } |
2384 break; |
2386 break; |
2385 |
2387 |
2386 case OT_LOADING: |
2388 case OT_LOADING: |
2387 case OT_LEAVESTATION: |
2389 case OT_LEAVESTATION: |
2393 /* check if we've reached the waypoint? */ |
2395 /* check if we've reached the waypoint? */ |
2394 bool at_waypoint = false; |
2396 bool at_waypoint = false; |
2395 if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) { |
2397 if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) { |
2396 v->cur_order_index++; |
2398 v->cur_order_index++; |
2397 at_waypoint = true; |
2399 at_waypoint = true; |
|
2400 UpdateVehicleTimetable(v, true); |
2398 } |
2401 } |
2399 |
2402 |
2400 /* check if we've reached a non-stop station while TTDPatch nonstop is enabled.. */ |
2403 /* check if we've reached a non-stop station while TTDPatch nonstop is enabled.. */ |
2401 if (_patches.new_nonstop && |
2404 if (_patches.new_nonstop && |
2402 v->current_order.flags & OF_NON_STOP && |
2405 v->current_order.flags & OF_NON_STOP && |
2403 IsTileType(v->tile, MP_STATION) && |
2406 IsTileType(v->tile, MP_STATION) && |
2404 v->current_order.dest == GetStationIndex(v->tile)) { |
2407 v->current_order.dest == GetStationIndex(v->tile)) { |
2405 v->cur_order_index++; |
2408 v->cur_order_index++; |
|
2409 UpdateVehicleTimetable(v, true); |
2406 } |
2410 } |
2407 |
2411 |
2408 /* Get the current order */ |
2412 /* Get the current order */ |
2409 if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0; |
2413 if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0; |
2410 |
2414 |
3294 v->cargo_days++; |
3298 v->cargo_days++; |
3295 |
3299 |
3296 v->tick_counter++; |
3300 v->tick_counter++; |
3297 |
3301 |
3298 if (IsFrontEngine(v)) { |
3302 if (IsFrontEngine(v)) { |
|
3303 v->current_order_time++; |
|
3304 |
3299 TrainLocoHandler(v, false); |
3305 TrainLocoHandler(v, false); |
3300 |
3306 |
3301 /* make sure vehicle wasn't deleted. */ |
3307 /* make sure vehicle wasn't deleted. */ |
3302 if (v->type == VEH_TRAIN && IsFrontEngine(v)) |
3308 if (v->type == VEH_TRAIN && IsFrontEngine(v)) |
3303 TrainLocoHandler(v, true); |
3309 TrainLocoHandler(v, true); |