MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ConKick

Function ConKick

src/console_cmds.cpp:723–744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

721}
722
723static bool ConKick(std::span<std::string_view> argv)
724{
725 if (argv.empty()) {
726 IConsolePrint(CC_HELP, "Kick a client from a network game. Usage: 'kick <ip | client-id> [<kick-reason>]'.");
727 IConsolePrint(CC_HELP, "For client-id's, see the command 'clients'.");
728 return true;
729 }
730
731 if (argv.size() != 2 && argv.size() != 3) return false;
732
733 /* No reason supplied for kicking */
734 if (argv.size() == 2) return ConKickOrBan(argv[1], false, {});
735
736 /* Reason for kicking supplied */
737 size_t kick_message_length = argv[2].size();
738 if (kick_message_length >= 255) {
739 IConsolePrint(CC_ERROR, "Maximum kick message length is 254 characters. You entered {} characters.", kick_message_length);
740 return false;
741 } else {
742 return ConKickOrBan(argv[1], false, argv[2]);
743 }
744}
745
746static bool ConBan(std::span<std::string_view> argv)
747{

Callers

nothing calls this directly

Calls 4

ConKickOrBanFunction · 0.85
IConsolePrintFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected