aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Ouellette <oue.paul18@gmail.com>2019-11-08 16:18:20 -0500
committerSmallJoker <SmallJoker@users.noreply.github.com>2019-11-08 22:18:20 +0100
commitd11bfa3ef5e8d63068096c52bc2faccba65b0b47 (patch)
tree62123c193e89c107b47df2acb82e1cc385d999d5
parent2a74727857a9bfd950ce1e6a58e0ade879033574 (diff)
downloadminetest-d11bfa3ef5e8d63068096c52bc2faccba65b0b47.tar.gz
minetest-d11bfa3ef5e8d63068096c52bc2faccba65b0b47.tar.bz2
minetest-d11bfa3ef5e8d63068096c52bc2faccba65b0b47.zip
Make core.get_favorites("local") ignore duplicates (#7926)
-rw-r--r--src/serverlist.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/serverlist.cpp b/src/serverlist.cpp
index 7d3ab4bbb..18264e933 100644
--- a/src/serverlist.cpp
+++ b/src/serverlist.cpp
@@ -155,6 +155,16 @@ std::vector<ServerListSpec> deSerialize(const std::string &liststring)
server["address"] = tmp;
std::getline(stream, tmp);
server["port"] = tmp;
+ bool unique = true;
+ for (const ServerListSpec &added : serverlist) {
+ if (server["name"] == added["name"]
+ && server["port"] == added["port"]) {
+ unique = false;
+ break;
+ }
+ }
+ if (!unique)
+ continue;
std::getline(stream, tmp);
server["description"] = tmp;
serverlist.push_back(server);