vehicle.c
changeset 2677 2c1fcffb304c
parent 2676 2ba71e034d97
child 2678 a0af6bded583
equal deleted inserted replaced
2676:2ba71e034d97 2677:2c1fcffb304c
  1563 		if (IsMultiheaded(v) && !IsTrainEngine(v)) {
  1563 		if (IsMultiheaded(v) && !IsTrainEngine(v)) {
  1564 			/* we build the rear ends of multiheaded trains with the front ones */
  1564 			/* we build the rear ends of multiheaded trains with the front ones */
  1565 			continue;
  1565 			continue;
  1566 		}
  1566 		}
  1567 
  1567 
  1568 		cost = DoCommand(x, y, v->engine_type, 2, flags, CMD_BUILD_VEH(v->type));
  1568 		cost = DoCommand(x, y, v->engine_type, 1, flags, CMD_BUILD_VEH(v->type));
  1569 
  1569 
  1570 		if (CmdFailed(cost)) return cost;
  1570 		if (CmdFailed(cost)) return cost;
  1571 
  1571 
  1572 		total_cost += cost;
  1572 		total_cost += cost;
  1573 
  1573 
  1648 	bool new_front = false;
  1648 	bool new_front = false;
  1649 	Vehicle *new_v = NULL;
  1649 	Vehicle *new_v = NULL;
  1650 
  1650 
  1651 	new_engine_type = p->engine_replacement[old_v->engine_type] == INVALID_ENGINE ? old_v->engine_type : p->engine_replacement[old_v->engine_type];
  1651 	new_engine_type = p->engine_replacement[old_v->engine_type] == INVALID_ENGINE ? old_v->engine_type : p->engine_replacement[old_v->engine_type];
  1652 
  1652 
  1653 	cost = DoCommand(old_v->x_pos, old_v->y_pos, new_engine_type, 2, flags, CMD_BUILD_VEH(old_v->type));
  1653 	cost = DoCommand(old_v->x_pos, old_v->y_pos, new_engine_type, 1, flags, CMD_BUILD_VEH(old_v->type));
  1654 	if (CmdFailed(cost)) return cost;
  1654 	if (CmdFailed(cost)) return cost;
  1655 
  1655 
  1656 	if (flags & DC_EXEC) {
  1656 	if (flags & DC_EXEC) {
  1657 		new_v = GetVehicle(_new_vehicle_id);
  1657 		new_v = GetVehicle(_new_vehicle_id);
  1658 		*w = new_v;	//we changed the vehicle, so MaybeReplaceVehicle needs to work on the new one. Now we tell it what the new one is
  1658 		*w = new_v;	//we changed the vehicle, so MaybeReplaceVehicle needs to work on the new one. Now we tell it what the new one is