src/vehicle.cpp
changeset 10285 82fa43e7b8f3
parent 10260 c6ec6b3c1b18
child 10314 ac0958307f68
equal deleted inserted replaced
10284:556d766023a4 10285:82fa43e7b8f3
   723  */
   723  */
   724 void VehicleEnteredDepotThisTick(Vehicle *v)
   724 void VehicleEnteredDepotThisTick(Vehicle *v)
   725 {
   725 {
   726 	/* We need to set v->leave_depot_instantly as we have no control of it's contents at this time.
   726 	/* We need to set v->leave_depot_instantly as we have no control of it's contents at this time.
   727 	 * Vehicle should stop in the depot if it was in 'stopping' state - train intered depot while slowing down. */
   727 	 * Vehicle should stop in the depot if it was in 'stopping' state - train intered depot while slowing down. */
   728 	if (((v->current_order.GetDepotActionType() & ODATFB_HALT) && !(v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) && v->current_order.IsType(OT_GOTO_DEPOT)) ||
   728 	if (((v->current_order.GetDepotActionType() & ODATFB_HALT) && v->current_order.IsType(OT_GOTO_DEPOT)) ||
   729 			(v->vehstatus & VS_STOPPED)) {
   729 			(v->vehstatus & VS_STOPPED)) {
   730 		/* we keep the vehicle in the depot since the user ordered it to stay */
   730 		/* we keep the vehicle in the depot since the user ordered it to stay */
       
   731 		v->vehstatus |= VS_STOPPED; // needed for refitting
   731 		v->leave_depot_instantly = false;
   732 		v->leave_depot_instantly = false;
   732 	} else {
   733 	} else {
   733 		/* the vehicle do not plan on stopping in the depot, so we stop it to ensure that it will not reserve the path
   734 		/* the vehicle do not plan on stopping in the depot, so we stop it to ensure that it will not reserve the path
   734 		 * out of the depot before we might autoreplace it to a different engine. The new engine would not own the reserved path
   735 		 * out of the depot before we might autoreplace it to a different engine. The new engine would not own the reserved path
   735 		 * we store that we stopped the vehicle, so autoreplace can start it again */
   736 		 * we store that we stopped the vehicle, so autoreplace can start it again */
  1621 
  1622 
  1622 		if (t.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) {
  1623 		if (t.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) {
  1623 			/* Part of orders */
  1624 			/* Part of orders */
  1624 			UpdateVehicleTimetable(v, true);
  1625 			UpdateVehicleTimetable(v, true);
  1625 			v->cur_order_index++;
  1626 			v->cur_order_index++;
  1626 		} else if (t.GetDepotActionType() & ODATFB_HALT) {
  1627 		}
       
  1628 		if (t.GetDepotActionType() & ODATFB_HALT) {
  1627 			/* Force depot visit */
  1629 			/* Force depot visit */
  1628 			v->vehstatus |= VS_STOPPED;
  1630 			v->vehstatus |= VS_STOPPED;
  1629 			if (v->owner == _local_company) {
  1631 			if (v->owner == _local_company) {
  1630 				StringID string;
  1632 				StringID string;
  1631 
  1633