Ablu/manaserv — comment on commit 2ad665cc3681214eefdd17afb60660567d045a9b
File:  line 0
By Bertram25:

You can use a std::set for that:
When inserting in a set, the insert() method returns a std::pair which the bool tells whether
the insertion was the first one in.

Thus, at map.xml load time, you can do this:

std::set nameSet;
for_each_xml_child_node(node, rootNode)
{
if (!xmlStrEqual(node->name, BAD_CAST "map"))
continue;
int id = XML::getProperty(node, "id", 0);
std::string name = XML::getProperty(node, "servername", std::string());

if (!nameSet.insert(name).second) // Note the .second to get the boolean and the '!' testing whether it's false.
LOG_DEBUG("Duplicate map name.");
else if (id > 0)
maps[id] = name;
else
LOG_WARN("Invalid map id found in " << mapReferenceFile);
}

I hope it helped you out. :) Thanks for the work done.