src/train_cmd.cpp
changeset 7642 535e5d93ffb1
parent 7607 c7df969919b3
child 7695 4b27fd86b318
equal deleted inserted replaced
7641:3a75903fd892 7642:535e5d93ffb1
   191 			}
   191 			}
   192 		}
   192 		}
   193 
   193 
   194 		if (!IsArticulatedPart(u)) {
   194 		if (!IsArticulatedPart(u)) {
   195 			/* Check powered wagon / visual effect callback */
   195 			/* Check powered wagon / visual effect callback */
   196 			if (HASBIT(EngInfo(u->engine_type)->callbackmask, CBM_WAGON_POWER)) {
   196 			if (HASBIT(EngInfo(u->engine_type)->callbackmask, CBM_TRAIN_WAGON_POWER)) {
   197 				uint16 callback = GetVehicleCallback(CBID_TRAIN_WAGON_POWER, 0, 0, u->engine_type, u);
   197 				uint16 callback = GetVehicleCallback(CBID_TRAIN_WAGON_POWER, 0, 0, u->engine_type, u);
   198 
   198 
   199 				if (callback != CALLBACK_FAILED) u->u.rail.cached_vis_effect = callback;
   199 				if (callback != CALLBACK_FAILED) u->u.rail.cached_vis_effect = callback;
   200 			}
   200 			}
   201 
   201 
  1623 	if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
  1623 	if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
  1624 
  1624 
  1625 	if (p2) {
  1625 	if (p2) {
  1626 		/* turn a single unit around */
  1626 		/* turn a single unit around */
  1627 
  1627 
  1628 		if (IsMultiheaded(v) || HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_ARTIC_ENGINE)) {
  1628 		if (IsMultiheaded(v) || HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) {
  1629 			return_cmd_error(STR_ONLY_TURN_SINGLE_UNIT);
  1629 			return_cmd_error(STR_ONLY_TURN_SINGLE_UNIT);
  1630 		}
  1630 		}
  1631 
  1631 
  1632 		Vehicle *front = v->First();
  1632 		Vehicle *front = v->First();
  1633 		/* make sure the vehicle is stopped in the depot */
  1633 		/* make sure the vehicle is stopped in the depot */
  1714 		if (!CanRefitTo(v->engine_type, new_cid)) continue;
  1714 		if (!CanRefitTo(v->engine_type, new_cid)) continue;
  1715 
  1715 
  1716 		if (v->cargo_cap != 0) {
  1716 		if (v->cargo_cap != 0) {
  1717 			uint16 amount = CALLBACK_FAILED;
  1717 			uint16 amount = CALLBACK_FAILED;
  1718 
  1718 
  1719 			if (HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_REFIT_CAPACITY)) {
  1719 			if (HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
  1720 				/* Back up the vehicle's cargo type */
  1720 				/* Back up the vehicle's cargo type */
  1721 				CargoID temp_cid = v->cargo_type;
  1721 				CargoID temp_cid = v->cargo_type;
  1722 				byte temp_subtype = v->cargo_subtype;
  1722 				byte temp_subtype = v->cargo_subtype;
  1723 				v->cargo_type = new_cid;
  1723 				v->cargo_type = new_cid;
  1724 				v->cargo_subtype = new_subtype;
  1724 				v->cargo_subtype = new_subtype;