MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / Disconnect

Method Disconnect

Source/Objects/movementobject.cpp:4325–4361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4323}
4324
4325bool 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
4363void MovementObject::GetConnectionIDs(std::vector<int>* cons) {
4364 if (connected_pathpoint_id != -1) {

Callers

nothing calls this directly

Calls 12

DetachItemMethod · 0.80
DisconnectFunction · 0.70
IsActiveMethod · 0.45
GetIDMethod · 0.45
GetTypeMethod · 0.45
CallScriptFunctionMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
getMethod · 0.45
AddMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected