static */
| 120 | } |
| 121 | |
| 122 | /* static */ bool ScriptVehicle::_MoveWagonInternal(VehicleID source_vehicle_id, SQInteger source_wagon, bool move_attached_wagons, SQInteger dest_vehicle_id, SQInteger dest_wagon) |
| 123 | { |
| 124 | EnforceCompanyModeValid(false); |
| 125 | EnforcePrecondition(false, IsValidVehicle(source_vehicle_id) && source_wagon < GetNumWagons(source_vehicle_id)); |
| 126 | EnforcePrecondition(false, dest_vehicle_id == -1 || (IsValidVehicle(static_cast<VehicleID>(dest_vehicle_id)) && dest_wagon < GetNumWagons(static_cast<VehicleID>(dest_vehicle_id)))); |
| 127 | EnforcePrecondition(false, ::Vehicle::Get(source_vehicle_id)->type == VEH_TRAIN); |
| 128 | EnforcePrecondition(false, dest_vehicle_id == -1 || ::Vehicle::Get(static_cast<VehicleID>(dest_vehicle_id))->type == VEH_TRAIN); |
| 129 | |
| 130 | const Train *v = ::Train::Get(source_vehicle_id); |
| 131 | while (source_wagon-- > 0) v = v->GetNextUnit(); |
| 132 | const Train *w = nullptr; |
| 133 | if (dest_vehicle_id != -1) { |
| 134 | w = ::Train::Get(dest_vehicle_id); |
| 135 | while (dest_wagon-- > 0) w = w->GetNextUnit(); |
| 136 | } |
| 137 | |
| 138 | return ScriptObject::Command<CMD_MOVE_RAIL_VEHICLE>::Do(v->index, w == nullptr ? VehicleID::Invalid() : w->index, move_attached_wagons); |
| 139 | } |
| 140 | |
| 141 | /* static */ bool ScriptVehicle::MoveWagon(VehicleID source_vehicle_id, SQInteger source_wagon, SQInteger dest_vehicle_id, SQInteger dest_wagon) |
| 142 | { |
nothing calls this directly
no test coverage detected