Merge pull request #1029 from ItsiAdam/increase-bots

Allow up to 255 bots
This commit is contained in:
LightCat 2020-06-05 20:46:56 +02:00 committed by GitHub
commit 3dd003f79c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

2
external/simple-ipc vendored

@ -1 +1 @@
Subproject commit c9c7f74a3697ea095ce304f8129b95e272e4f6fd
Subproject commit 3db1b6976b75e469bad11749b98ba5aca911c794

View File

@ -113,9 +113,9 @@ void onKilledBy(unsigned id)
{
std::string command = "cat_ipc_exec_all cat_pl_mark_betrayal " + std::to_string(id);
if (command.length() >= 63)
ipc::peer->SendMessage(0, 0, ipc::commands::execute_client_cmd_long, command.c_str(), command.length() + 1);
ipc::peer->SendMessage(0, -1, ipc::commands::execute_client_cmd_long, command.c_str(), command.length() + 1);
else
ipc::peer->SendMessage(command.c_str(), 0, ipc::commands::execute_client_cmd, 0, 0);
ipc::peer->SendMessage(command.c_str(), -1, ipc::commands::execute_client_cmd, 0, 0);
}
}
}

View File

@ -758,11 +758,11 @@ static CatCommand follow_me("fb_follow_me", "IPC connected bots will follow you"
std::string tmp = CON_PREFIX + follow_steam.name + " " + std::to_string(steam_id);
if (tmp.length() >= 63)
{
ipc::peer->SendMessage(0, 0, ipc::commands::execute_client_cmd_long, tmp.c_str(), tmp.length() + 1);
ipc::peer->SendMessage(0, -1, ipc::commands::execute_client_cmd_long, tmp.c_str(), tmp.length() + 1);
}
else
{
ipc::peer->SendMessage(tmp.c_str(), 0, ipc::commands::execute_client_cmd, 0, 0);
ipc::peer->SendMessage(tmp.c_str(), -1, ipc::commands::execute_client_cmd, 0, 0);
}
});
#endif

View File

@ -80,7 +80,7 @@ CatCommand exec("ipc_exec", "Execute command (first argument = bot ID)", [](cons
logging::Info("Target id is NaN!");
return;
}
if (target_id == 0 || target_id > 31)
if (target_id < 0 || target_id > 255)
{
logging::Info("Invalid target id: %u", target_id);
return;
@ -97,11 +97,11 @@ CatCommand exec("ipc_exec", "Execute command (first argument = bot ID)", [](cons
ReplaceString(command, " && ", " ; ");
if (command.length() >= 63)
{
peer->SendMessage(0, (1 << target_id), ipc::commands::execute_client_cmd_long, command.c_str(), command.length() + 1);
peer->SendMessage(0, target_id, ipc::commands::execute_client_cmd_long, command.c_str(), command.length() + 1);
}
else
{
peer->SendMessage(command.c_str(), (1 << target_id), ipc::commands::execute_client_cmd, 0, 0);
peer->SendMessage(command.c_str(), target_id, ipc::commands::execute_client_cmd, 0, 0);
}
});
CatCommand exec_all("ipc_exec_all", "Execute command (on every peer)", [](const CCommand &args) {
@ -109,11 +109,11 @@ CatCommand exec_all("ipc_exec_all", "Execute command (on every peer)", [](const
ReplaceString(command, " && ", " ; ");
if (command.length() >= 63)
{
peer->SendMessage(0, 0, ipc::commands::execute_client_cmd_long, command.c_str(), command.length() + 1);
peer->SendMessage(0, -1, ipc::commands::execute_client_cmd_long, command.c_str(), command.length() + 1);
}
else
{
peer->SendMessage(command.c_str(), 0, ipc::commands::execute_client_cmd, 0, 0);
peer->SendMessage(command.c_str(), -1, ipc::commands::execute_client_cmd, 0, 0);
}
});
@ -133,7 +133,7 @@ CatCommand debug_get_ingame_ipc("ipc_debug_dump_server", "Show other bots on ser
int count = 0;
unsigned highest = 0;
std::vector<unsigned> botlist{};
for (unsigned i = 1; i < cat_ipc::max_peers; i++)
for (unsigned i = 0; i < cat_ipc::max_peers; i++)
{
if (!ipc::peer->memory->peer_data[i].free)
{