src/train_cmd.cpp
changeset 9336 3f75a2c5e0d3
parent 9332 2e120d0bd632
child 9339 daaa2adbaf99
equal deleted inserted replaced
9335:18d3658adc60 9336:3f75a2c5e0d3
  2340 }
  2340 }
  2341 
  2341 
  2342 static void FillWithStationData(TrainTrackFollowerData* fd, const Vehicle* v)
  2342 static void FillWithStationData(TrainTrackFollowerData* fd, const Vehicle* v)
  2343 {
  2343 {
  2344 	fd->dest_coords = v->dest_tile;
  2344 	fd->dest_coords = v->dest_tile;
  2345 	fd->station_index = v->current_order.IsType(OT_GOTO_STATION) ? v->current_order.dest : INVALID_STATION;
  2345 	fd->station_index = v->current_order.IsType(OT_GOTO_STATION) ? v->current_order.GetDestination() : INVALID_STATION;
  2346 }
  2346 }
  2347 
  2347 
  2348 static const byte _initial_tile_subcoord[6][4][3] = {
  2348 static const byte _initial_tile_subcoord[6][4][3] = {
  2349 {{ 15, 8, 1 }, { 0, 0, 0 }, { 0, 8, 5 }, { 0,  0, 0 }},
  2349 {{ 15, 8, 1 }, { 0, 0, 0 }, { 0, 8, 5 }, { 0,  0, 0 }},
  2350 {{  0, 0, 0 }, { 8, 0, 3 }, { 0, 0, 0 }, { 8, 15, 7 }},
  2350 {{  0, 0, 0 }, { 8, 0, 3 }, { 0, 0, 0 }, { 8, 15, 7 }},
  2656 			0
  2656 			0
  2657 		);
  2657 		);
  2658 	}
  2658 	}
  2659 
  2659 
  2660 	v->BeginLoading();
  2660 	v->BeginLoading();
  2661 	v->current_order.dest = 0;
       
  2662 }
  2661 }
  2663 
  2662 
  2664 static byte AfterSetTrainPos(Vehicle *v, bool new_tile)
  2663 static byte AfterSetTrainPos(Vehicle *v, bool new_tile)
  2665 {
  2664 {
  2666 	byte old_z = v->z_pos;
  2665 	byte old_z = v->z_pos;
  3557 	}
  3556 	}
  3558 
  3557 
  3559 	const Depot* depot = GetDepotByTile(tfdd.tile);
  3558 	const Depot* depot = GetDepotByTile(tfdd.tile);
  3560 
  3559 
  3561 	if (v->current_order.IsType(OT_GOTO_DEPOT) &&
  3560 	if (v->current_order.IsType(OT_GOTO_DEPOT) &&
  3562 			v->current_order.dest != depot->index &&
  3561 			v->current_order.GetDestination() != depot->index &&
  3563 			!Chance16(3, 16)) {
  3562 			!Chance16(3, 16)) {
  3564 		return;
  3563 		return;
  3565 	}
  3564 	}
  3566 
  3565 
  3567 	v->current_order.MakeGoToDepot(depot->index, false);
  3566 	v->current_order.MakeGoToDepot(depot->index, false);
  3581 
  3580 
  3582 		CheckOrders(this);
  3581 		CheckOrders(this);
  3583 
  3582 
  3584 		/* update destination */
  3583 		/* update destination */
  3585 		if (this->current_order.IsType(OT_GOTO_STATION)) {
  3584 		if (this->current_order.IsType(OT_GOTO_STATION)) {
  3586 			TileIndex tile = GetStation(this->current_order.dest)->train_tile;
  3585 			TileIndex tile = GetStation(this->current_order.GetDestination())->train_tile;
  3587 			if (tile != 0) this->dest_tile = tile;
  3586 			if (tile != 0) this->dest_tile = tile;
  3588 		}
  3587 		}
  3589 
  3588 
  3590 		if (this->running_ticks != 0) {
  3589 		if (this->running_ticks != 0) {
  3591 			/* running costs */
  3590 			/* running costs */