Changeset - r22693:9c2cc76bc7f7
[Not reviewed]
master
0 1 0
adf88 - 7 years ago 2017-09-10 14:03:29
adf88@openttd.org
(svn r27914) -Fix/Feature: 'unban' console command - fix invalid help text and be more verbose
1 file changed with 6 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/console_cmds.cpp
Show inline comments
 
@@ -553,9 +553,8 @@ DEF_CONSOLE_CMD(ConBan)
 

	
 
DEF_CONSOLE_CMD(ConUnBan)
 
{
 

	
 
	if (argc == 0) {
 
		IConsoleHelp("Unban a client from a network game. Usage: 'unban <ip | client-id>'");
 
		IConsoleHelp("Unban a client from a network game. Usage: 'unban <ip | banlist-index>'");
 
		IConsoleHelp("For a list of banned IP's, see the command 'banlist'");
 
		return true;
 
	}
 
@@ -574,11 +573,14 @@ DEF_CONSOLE_CMD(ConUnBan)
 
	}
 

	
 
	if (index < _network_ban_list.Length()) {
 
		char msg[64];
 
		seprintf(msg, lastof(msg), "Unbanned %s", _network_ban_list[index]);
 
		IConsolePrint(CC_DEFAULT, msg);
 
		free(_network_ban_list[index]);
 
		_network_ban_list.Erase(_network_ban_list.Get(index));
 
		IConsolePrint(CC_DEFAULT, "IP unbanned.");
 
	} else {
 
		IConsolePrint(CC_DEFAULT, "IP not in ban-list.");
 
		IConsolePrint(CC_DEFAULT, "Invalid list index or IP not in ban-list.");
 
		IConsolePrint(CC_DEFAULT, "For a list of banned IP's, see the command 'banlist'");
 
	}
 

	
 
	return true;
0 comments (0 inline, 0 general)