51 logger->
log1(
"Initializing group database...");
59 #define servercommandFirst(name) \
61 return ServerCommandType::name; \
63 #define servercommand(name) \
65 return ServerCommandType::name; \
67 #define servercommand2(name1, name2) \
69 return ServerCommandType::name1; \
75 #include "resources/servercommands.inc"
77 reportAlways(
"GroupsDb: unknown command name: '%s' in group id '%d'.",
86 #undef servercommandFirst
90 #define serverpermissionFirst(name) \
92 return ServerPermissionType::name; \
94 #define serverpermission(name) \
96 return ServerPermissionType::name; \
102 #include "resources/serverpermissions.inc"
105 "'%s' in group id '%d'.",
113 SERVERPERMISSION_VOID
114 #undef serverpermissionFirst
115 #undef serverpermission
124 else if (str ==
"other")
128 else if (str ==
"both")
132 else if (str ==
"false")
138 reportAlways(
"GroupsDb: unknown use flag: '%s' in group id '%d'."
139 "Possible values 'self', 'other', 'both'.",
155 if (xmlNameEqual(node,
"command"))
183 if (xmlNameEqual(node,
"permission"))
211 if (xmlNameEqual(node,
"commands"))
213 if (xmlNameEqual(node,
"permissions"))
228 STD_VECTOR<int> parts;
230 FOR_EACH (STD_VECTOR<int>::const_iterator, it, parts)
233 GroupDb::GroupInfos::const_iterator it2 =
mGroups.find(id2);
236 reportAlways(
"Unknown inherit group id '%d' in group '%d'",
241 GroupInfo *
const groupInfo2 = (*it2).second;
262 XmlNodeConstPtrConst rootNode = doc.
rootNode();
264 if (rootNode ==
nullptr ||
265 !xmlNameEqual(rootNode,
"groups"))
269 logger->
log(
"GroupsDb: Error while loading %s!",
282 if (xmlNameEqual(node,
"include"))
289 if (xmlNameEqual(node,
"group"))
305 group = (*it).second;
346 GroupInfos::const_iterator it =
mGroups.find(
id);
352 return (*it).second->name;
357 GroupInfos::const_iterator it =
mGroups.find(
id);
363 return (*it).second->longName;
368 GroupInfos::const_iterator it =
mGroups.find(
id);
374 return (*it).second->showBadge;
379 GroupInfos::const_iterator it =
mGroups.find(
id);
385 return (*it).second->highlightName;
390 GroupInfos::const_iterator it =
mGroups.find(
id);
396 return (*it).second->badge;
401 GroupInfos::const_iterator it =
mGroups.find(
id);
static void loadXmlFile(const std::string &file, const std::string &name, BadgesInfos &arr, const SkipError skipError)
#define loadXmlDir(name, function)
#define reportAlways(...)
std::string getStringValue(const std::string &key) const
void log(const char *const log_text,...)
void log1(const char *const log_text)
#define FOR_EACH(type, iter, array)
static ServerCommandTypeT parseCommand(const std::string &str, const int id)
static ServerCommandEnable::Type parseUseFlag(const std::string &str, const int id)
static void loadCommands(xmlNodePtr rootNode, const int id, GroupInfo *groupInfo)
static ServerPermissionTypeT parsePermission(const std::string &str, const int id)
static void loadSubNodes(xmlNodePtr groupNode, const int id, GroupInfo *groupInfo)
static void parseInherit(xmlNodePtr groupNode, const int id, GroupInfo *groupInfo)
static void loadPermissions(xmlNodePtr rootNode, const int id, GroupInfo *groupInfo)
#define for_each_xml_child_node(var, parent)
LocalPlayer * localPlayer
const std::string & getBadge(const int id)
void loadXmlFile(const std::string &fileName, const SkipError skipError)
bool getShowBadge(const int id)
bool getHighlightName(const int id)
const std::string & getName(const int id)
bool isAllowCommand(const ServerCommandTypeT command)
GroupInfos::iterator GroupInfosIter
std::map< int, GroupInfo * > GroupInfos
const GroupInfo * getGroup(const int id)
const std::string & getLongName(const int id)
ServerTypeT getNetworkType()
std::string langProperty(const xmlNodePtr node, const char *const name, const std::string &def)
bool getBoolProperty(const xmlNodePtr node, const char *const name, const bool def)
int getProperty(const xmlNodePtr node, const char *const name, int def)
GroupDb::GroupInfos mGroups
const GroupInfo mEmptyGroup
ServerCommandType ::T ServerCommandTypeT
ServerPermissionType ::T ServerPermissionTypeT
const bool SkipError_false
const bool SkipError_true
void splitToIntVector(std::vector< int > &tokens, const std::string &text, const char separator)
Enable mPermissions[static_cast< size_t >(ServerPermissionType::Max)]
ServerCommandEnable::Type mCommands[static_cast< size_t >(ServerCommandType::Max)]
const bool UseVirtFs_true