about summary refs log tree commit diff stats
path: root/src/network_set.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-09-08 08:51:43 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-09-08 08:51:43 -0400
commit0e6be5bbe8c506882e8100ccaaf13a5f58079f97 (patch)
tree4fee4d578e7936cb4052a74b93064c5ea845521f /src/network_set.cpp
parentc443acfd0b25b3e4f3446f795777b8dd18b00e2b (diff)
parent86b4b06e78c5c71588c1b55273969a1327a6710a (diff)
downloadlingo-ap-tracker-0e6be5bbe8c506882e8100ccaaf13a5f58079f97.tar.gz
lingo-ap-tracker-0e6be5bbe8c506882e8100ccaaf13a5f58079f97.tar.bz2
lingo-ap-tracker-0e6be5bbe8c506882e8100ccaaf13a5f58079f97.zip
Merge branch 'main' into panels
Diffstat (limited to 'src/network_set.cpp')
-rw-r--r--src/network_set.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/network_set.cpp b/src/network_set.cpp index 6d2a098..2a9e12c 100644 --- a/src/network_set.cpp +++ b/src/network_set.cpp
@@ -21,6 +21,19 @@ void NetworkSet::AddLink(int id1, int id2) {
21 network_by_item_[id2].insert({id1, id2}); 21 network_by_item_[id2].insert({id1, id2});
22} 22}
23 23
24void NetworkSet::AddLinkToNetwork(int network_id, int id1, int id2) {
25 if (id2 > id1) {
26 // Make sure id1 < id2
27 std::swap(id1, id2);
28 }
29
30 if (!network_by_item_.count(network_id)) {
31 network_by_item_[network_id] = {};
32 }
33
34 network_by_item_[network_id].insert({id1, id2});
35}
36
24bool NetworkSet::IsItemInNetwork(int id) const { 37bool NetworkSet::IsItemInNetwork(int id) const {
25 return network_by_item_.count(id); 38 return network_by_item_.count(id);
26} 39}