| 4323 | } |
| 4324 | |
| 4325 | bool MovementObject::Disconnect(Object& other, bool from_socket /* = false */, bool checking_other /*= false*/) { |
| 4326 | Online* online = Online::Instance(); |
| 4327 | if (online->IsActive() && !from_socket) { |
| 4328 | online->Send<OnlineMessages::AttachToMessage>(GetID(), other.GetID(), 0, false, false); |
| 4329 | } |
| 4330 | |
| 4331 | if (connected_pathpoint_id == other.GetID() && (other.GetType() == _path_point_object || other.GetType() == _movement_object)) { |
| 4332 | connected_pathpoint_id = -1; |
| 4333 | as_context->CallScriptFunction(as_funcs.reset_waypoint_target); |
| 4334 | return true; |
| 4335 | } else if (other.GetType() == _item_object) { |
| 4336 | for (std::list<ItemObjectScriptReader>::iterator iter = item_connections.begin(); |
| 4337 | iter != item_connections.end();) { |
| 4338 | if ((*iter)->GetID() == other.GetID()) { |
| 4339 | iter = item_connections.erase(iter); |
| 4340 | if (as_context.get()) { |
| 4341 | ASArglist args; |
| 4342 | args.Add(other.GetID()); |
| 4343 | as_context->CallScriptFunction(as_funcs.notify_item_detach, &args); |
| 4344 | } |
| 4345 | rigged_object_->DetachItem((ItemObject*)&other); |
| 4346 | ((ItemObject*)(&other))->Reset(); |
| 4347 | } else { |
| 4348 | ++iter; |
| 4349 | } |
| 4350 | } |
| 4351 | return true; |
| 4352 | } else if (other.GetType() == _hotspot_object) { |
| 4353 | return Object::Disconnect(other, checking_other); |
| 4354 | } else { |
| 4355 | if (checking_other) { |
| 4356 | return false; |
| 4357 | } else { |
| 4358 | return other.Disconnect(*this, true); |
| 4359 | } |
| 4360 | } |
| 4361 | } |
| 4362 | |
| 4363 | void MovementObject::GetConnectionIDs(std::vector<int>* cons) { |
| 4364 | if (connected_pathpoint_id != -1) { |
nothing calls this directly
no test coverage detected