mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-10 13:23:52 +00:00
Fix-up in command system procedural code
This commit is contained in:
parent
d341a1b38f
commit
3092a8ba3b
@ -1432,8 +1432,8 @@ int bot_command_init(void)
|
||||
auto working_bcl = bot_command_list;
|
||||
for (auto working_bcl_iter : working_bcl) {
|
||||
|
||||
auto bot_command_settings_iter = bot_command_settings.find(working_bcl_iter.first);
|
||||
if (bot_command_settings_iter == bot_command_settings.end()) {
|
||||
auto bcs_iter = bot_command_settings.find(working_bcl_iter.first);
|
||||
if (bcs_iter == bot_command_settings.end()) {
|
||||
|
||||
injected_bot_command_settings.push_back(std::pair<std::string, uint8>(working_bcl_iter.first, working_bcl_iter.second->access));
|
||||
Log(Logs::General,
|
||||
@ -1454,32 +1454,42 @@ int bot_command_init(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
working_bcl_iter.second->access = bot_command_settings_iter->second.first;
|
||||
working_bcl_iter.second->access = bcs_iter->second.first;
|
||||
Log(Logs::General,
|
||||
Logs::Commands,
|
||||
"bot_command_init(): - Bot Command '%s' set to access level %d.",
|
||||
working_bcl_iter.first.c_str(),
|
||||
bot_command_settings_iter->second.first
|
||||
bcs_iter->second.first
|
||||
);
|
||||
|
||||
if (bot_command_settings_iter->second.second.empty()) {
|
||||
if (bcs_iter->second.second.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto alias_iter : bot_command_settings_iter->second.second) {
|
||||
for (auto alias_iter : bcs_iter->second.second) {
|
||||
if (alias_iter.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bot_command_list.find(alias_iter) != bot_command_list.end()) {
|
||||
Log(Logs::General, Logs::Commands, "bot_command_init(): Warning: Alias '%s' already exists as a bot command - skipping!", alias_iter.c_str());
|
||||
Log(Logs::General,
|
||||
Logs::Commands,
|
||||
"bot_command_init(): Warning: Alias '%s' already exists as a bot command - skipping!",
|
||||
alias_iter.c_str()
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
bot_command_list[alias_iter] = working_bcl_iter.second;
|
||||
bot_command_aliases[alias_iter] = working_bcl_iter.first;
|
||||
|
||||
Log(Logs::General, Logs::Commands, "bot_command_init(): - Alias '%s' added to bot command '%s'.", alias_iter.c_str(), bot_command_aliases[alias_iter].c_str());
|
||||
Log(Logs::General,
|
||||
Logs::Commands,
|
||||
"bot_command_init(): - Alias '%s' added to bot command '%s'.",
|
||||
alias_iter.c_str(),
|
||||
bot_command_aliases[alias_iter].c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -456,66 +456,66 @@ int command_init(void)
|
||||
std::vector<std::pair<std::string, uint8>> injected_command_settings;
|
||||
std::vector<std::string> orphaned_command_settings;
|
||||
|
||||
std::map<std::string, CommandRecord *> working_cl = commandlist;
|
||||
for (auto iter_cl = working_cl.begin(); iter_cl != working_cl.end(); ++iter_cl) {
|
||||
auto working_cl = commandlist;
|
||||
for (auto working_cl_iter : working_cl) {
|
||||
|
||||
auto iter_cs = command_settings.find(iter_cl->first);
|
||||
if (iter_cs == command_settings.end()) {
|
||||
auto cs_iter = command_settings.find(working_cl_iter.first);
|
||||
if (cs_iter == command_settings.end()) {
|
||||
|
||||
injected_command_settings.push_back(std::pair<std::string, uint8>(iter_cl->first, iter_cl->second->access));
|
||||
injected_command_settings.push_back(std::pair<std::string, uint8>(working_cl_iter.first, working_cl_iter.second->access));
|
||||
Log(Logs::General,
|
||||
Logs::Status,
|
||||
"New Command '%s' found... Adding to `command_settings` table with access '%u'...",
|
||||
iter_cl->first.c_str(),
|
||||
iter_cl->second->access
|
||||
working_cl_iter.first.c_str(),
|
||||
working_cl_iter.second->access
|
||||
);
|
||||
|
||||
if (iter_cl->second->access == 0) {
|
||||
if (working_cl_iter.second->access == 0) {
|
||||
Log(Logs::General,
|
||||
Logs::Commands,
|
||||
"command_init(): Warning: Command '%s' defaulting to access level 0!",
|
||||
iter_cl->first.c_str()
|
||||
working_cl_iter.first.c_str()
|
||||
);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
iter_cl->second->access = iter_cs->second.first;
|
||||
working_cl_iter.second->access = cs_iter->second.first;
|
||||
Log(Logs::General,
|
||||
Logs::Commands,
|
||||
"command_init(): - Command '%s' set to access level %d.",
|
||||
iter_cl->first.c_str(),
|
||||
iter_cs->second.first
|
||||
working_cl_iter.first.c_str(),
|
||||
cs_iter->second.first
|
||||
);
|
||||
|
||||
if (iter_cs->second.second.empty()) {
|
||||
if (cs_iter->second.second.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto iter_aka = iter_cs->second.second.begin(); iter_aka != iter_cs->second.second.end(); ++iter_aka) {
|
||||
if (iter_aka->empty()) {
|
||||
for (auto alias_iter : cs_iter->second.second) {
|
||||
if (alias_iter.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (commandlist.find(*iter_aka) != commandlist.end()) {
|
||||
if (commandlist.find(alias_iter) != commandlist.end()) {
|
||||
Log(Logs::General,
|
||||
Logs::Commands,
|
||||
"command_init(): Warning: Alias '%s' already exists as a command - skipping!",
|
||||
iter_aka->c_str()
|
||||
alias_iter.c_str()
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
commandlist[*iter_aka] = iter_cl->second;
|
||||
commandaliases[*iter_aka] = iter_cl->first;
|
||||
commandlist[alias_iter] = working_cl_iter.second;
|
||||
commandaliases[alias_iter] = working_cl_iter.first;
|
||||
|
||||
Log(Logs::General,
|
||||
Logs::Commands,
|
||||
"command_init(): - Alias '%s' added to command '%s'.",
|
||||
iter_aka->c_str(),
|
||||
commandaliases[*iter_aka].c_str()
|
||||
alias_iter.c_str(),
|
||||
commandaliases[alias_iter].c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user