diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-09-08 08:51:43 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-09-08 08:51:43 -0400 |
commit | 0e6be5bbe8c506882e8100ccaaf13a5f58079f97 (patch) | |
tree | 4fee4d578e7936cb4052a74b93064c5ea845521f /src/network_set.cpp | |
parent | c443acfd0b25b3e4f3446f795777b8dd18b00e2b (diff) | |
parent | 86b4b06e78c5c71588c1b55273969a1327a6710a (diff) | |
download | lingo-ap-tracker-0e6be5bbe8c506882e8100ccaaf13a5f58079f97.tar.gz lingo-ap-tracker-0e6be5bbe8c506882e8100ccaaf13a5f58079f97.tar.bz2 lingo-ap-tracker-0e6be5bbe8c506882e8100ccaaf13a5f58079f97.zip |
Merge branch 'main' into panels panels
Diffstat (limited to 'src/network_set.cpp')
-rw-r--r-- | src/network_set.cpp | 13 |
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 | ||
24 | void 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 | |||
24 | bool NetworkSet::IsItemInNetwork(int id) const { | 37 | bool NetworkSet::IsItemInNetwork(int id) const { |
25 | return network_by_item_.count(id); | 38 | return network_by_item_.count(id); |
26 | } | 39 | } |