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

Method FinalizeLoadedConnections

Source/Objects/movementobject.cpp:4407–4466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4405}
4406
4407void MovementObject::FinalizeLoadedConnections() {
4408 Object::FinalizeLoadedConnections();
4409 if (do_connection_finalization_remap) {
4410 if (connection_finalization_remap.find(connected_pathpoint_id) != connection_finalization_remap.end()) {
4411 connected_pathpoint_id = connection_finalization_remap[connected_pathpoint_id];
4412 } else {
4413 connected_pathpoint_id = -1;
4414 }
4415 }
4416
4417 for (auto& item_connection : item_connection_vec) {
4418 if (do_connection_finalization_remap) {
4419 if (connection_finalization_remap.find(item_connection.id) != connection_finalization_remap.end()) {
4420 item_connection.id = connection_finalization_remap[item_connection.id];
4421 } else {
4422 item_connection.id = -1;
4423 }
4424 }
4425
4426 int which = item_connection.id;
4427 AttachmentType type = item_connection.attachment_type;
4428 bool mirrored = item_connection.mirrored;
4429 AttachItemToSlotEditor(which, type, mirrored, item_connection.attachment_ref);
4430 }
4431 item_connection_vec.clear();
4432
4433 if (!env_object_attach_data.empty()) {
4434 std::vector<AttachedEnvObject> attached_env_objects;
4435 Deserialize(env_object_attach_data, attached_env_objects);
4436 for (int i = 0; i < (int)attached_env_objects.size();) {
4437 if (!attached_env_objects[i].direct_ptr) {
4438 if (do_connection_finalization_remap) {
4439 if (connection_finalization_remap.find(attached_env_objects[i].legacy_obj_id) != connection_finalization_remap.end()) {
4440 attached_env_objects[i].legacy_obj_id = connection_finalization_remap[attached_env_objects[i].legacy_obj_id];
4441 } else {
4442 attached_env_objects[i].legacy_obj_id = -1;
4443 }
4444 }
4445
4446 Object* obj = scenegraph_->GetObjectFromID(attached_env_objects[i].legacy_obj_id);
4447 if (obj) {
4448 attached_env_objects[i].direct_ptr = obj;
4449 obj->SetParent(this);
4450 ++i;
4451 } else {
4452 attached_env_objects[i] = attached_env_objects.back();
4453 attached_env_objects.resize(attached_env_objects.size() - 1);
4454 }
4455 } else {
4456 ++i;
4457 }
4458 }
4459 if (rigged_object_.get()) {
4460 rigged_object_->children = attached_env_objects;
4461 }
4462 Serialize(attached_env_objects, env_object_attach_data);
4463 }
4464 connection_finalization_remap.clear();

Callers

nothing calls this directly

Calls 12

DeserializeFunction · 0.85
SerializeFunction · 0.85
GetObjectFromIDMethod · 0.80
findMethod · 0.45
endMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
SetParentMethod · 0.45
backMethod · 0.45
resizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected