mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-01 15:32:25 +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;
|
auto working_bcl = bot_command_list;
|
||||||
for (auto working_bcl_iter : working_bcl) {
|
for (auto working_bcl_iter : working_bcl) {
|
||||||
|
|
||||||
auto bot_command_settings_iter = bot_command_settings.find(working_bcl_iter.first);
|
auto bcs_iter = bot_command_settings.find(working_bcl_iter.first);
|
||||||
if (bot_command_settings_iter == bot_command_settings.end()) {
|
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));
|
injected_bot_command_settings.push_back(std::pair<std::string, uint8>(working_bcl_iter.first, working_bcl_iter.second->access));
|
||||||
Log(Logs::General,
|
Log(Logs::General,
|
||||||
@ -1454,32 +1454,42 @@ int bot_command_init(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
working_bcl_iter.second->access = bot_command_settings_iter->second.first;
|
working_bcl_iter.second->access = bcs_iter->second.first;
|
||||||
Log(Logs::General,
|
Log(Logs::General,
|
||||||
Logs::Commands,
|
Logs::Commands,
|
||||||
"bot_command_init(): - Bot Command '%s' set to access level %d.",
|
"bot_command_init(): - Bot Command '%s' set to access level %d.",
|
||||||
working_bcl_iter.first.c_str(),
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto alias_iter : bot_command_settings_iter->second.second) {
|
for (auto alias_iter : bcs_iter->second.second) {
|
||||||
if (alias_iter.empty()) {
|
if (alias_iter.empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bot_command_list.find(alias_iter) != bot_command_list.end()) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bot_command_list[alias_iter] = working_bcl_iter.second;
|
bot_command_list[alias_iter] = working_bcl_iter.second;
|
||||||
bot_command_aliases[alias_iter] = working_bcl_iter.first;
|
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::pair<std::string, uint8>> injected_command_settings;
|
||||||
std::vector<std::string> orphaned_command_settings;
|
std::vector<std::string> orphaned_command_settings;
|
||||||
|
|
||||||
std::map<std::string, CommandRecord *> working_cl = commandlist;
|
auto working_cl = commandlist;
|
||||||
for (auto iter_cl = working_cl.begin(); iter_cl != working_cl.end(); ++iter_cl) {
|
for (auto working_cl_iter : working_cl) {
|
||||||
|
|
||||||
auto iter_cs = command_settings.find(iter_cl->first);
|
auto cs_iter = command_settings.find(working_cl_iter.first);
|
||||||
if (iter_cs == command_settings.end()) {
|
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,
|
Log(Logs::General,
|
||||||
Logs::Status,
|
Logs::Status,
|
||||||
"New Command '%s' found... Adding to `command_settings` table with access '%u'...",
|
"New Command '%s' found... Adding to `command_settings` table with access '%u'...",
|
||||||
iter_cl->first.c_str(),
|
working_cl_iter.first.c_str(),
|
||||||
iter_cl->second->access
|
working_cl_iter.second->access
|
||||||
);
|
);
|
||||||
|
|
||||||
if (iter_cl->second->access == 0) {
|
if (working_cl_iter.second->access == 0) {
|
||||||
Log(Logs::General,
|
Log(Logs::General,
|
||||||
Logs::Commands,
|
Logs::Commands,
|
||||||
"command_init(): Warning: Command '%s' defaulting to access level 0!",
|
"command_init(): Warning: Command '%s' defaulting to access level 0!",
|
||||||
iter_cl->first.c_str()
|
working_cl_iter.first.c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
iter_cl->second->access = iter_cs->second.first;
|
working_cl_iter.second->access = cs_iter->second.first;
|
||||||
Log(Logs::General,
|
Log(Logs::General,
|
||||||
Logs::Commands,
|
Logs::Commands,
|
||||||
"command_init(): - Command '%s' set to access level %d.",
|
"command_init(): - Command '%s' set to access level %d.",
|
||||||
iter_cl->first.c_str(),
|
working_cl_iter.first.c_str(),
|
||||||
iter_cs->second.first
|
cs_iter->second.first
|
||||||
);
|
);
|
||||||
|
|
||||||
if (iter_cs->second.second.empty()) {
|
if (cs_iter->second.second.empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto iter_aka = iter_cs->second.second.begin(); iter_aka != iter_cs->second.second.end(); ++iter_aka) {
|
for (auto alias_iter : cs_iter->second.second) {
|
||||||
if (iter_aka->empty()) {
|
if (alias_iter.empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commandlist.find(*iter_aka) != commandlist.end()) {
|
if (commandlist.find(alias_iter) != commandlist.end()) {
|
||||||
Log(Logs::General,
|
Log(Logs::General,
|
||||||
Logs::Commands,
|
Logs::Commands,
|
||||||
"command_init(): Warning: Alias '%s' already exists as a command - skipping!",
|
"command_init(): Warning: Alias '%s' already exists as a command - skipping!",
|
||||||
iter_aka->c_str()
|
alias_iter.c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
commandlist[*iter_aka] = iter_cl->second;
|
commandlist[alias_iter] = working_cl_iter.second;
|
||||||
commandaliases[*iter_aka] = iter_cl->first;
|
commandaliases[alias_iter] = working_cl_iter.first;
|
||||||
|
|
||||||
Log(Logs::General,
|
Log(Logs::General,
|
||||||
Logs::Commands,
|
Logs::Commands,
|
||||||
"command_init(): - Alias '%s' added to command '%s'.",
|
"command_init(): - Alias '%s' added to command '%s'.",
|
||||||
iter_aka->c_str(),
|
alias_iter.c_str(),
|
||||||
commandaliases[*iter_aka].c_str()
|
commandaliases[alias_iter].c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user