mirror of
https://github.com/minetest/minetest.git
synced 2024-12-25 07:32:24 +01:00
Make core.get_favorites("local") ignore duplicates (#7926)
This commit is contained in:
parent
2a74727857
commit
d11bfa3ef5
@ -155,6 +155,16 @@ std::vector<ServerListSpec> deSerialize(const std::string &liststring)
|
|||||||
server["address"] = tmp;
|
server["address"] = tmp;
|
||||||
std::getline(stream, tmp);
|
std::getline(stream, tmp);
|
||||||
server["port"] = 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);
|
std::getline(stream, tmp);
|
||||||
server["description"] = tmp;
|
server["description"] = tmp;
|
||||||
serverlist.push_back(server);
|
serverlist.push_back(server);
|
||||||
|
Loading…
Reference in New Issue
Block a user