console_cmds.c
changeset 4883 801b93ae218c
parent 4878 744717de172e
child 4906 8a10678a62a3
equal deleted inserted replaced
4882:663954e4486f 4883:801b93ae218c
   656 	return true;
   656 	return true;
   657 }
   657 }
   658 
   658 
   659 DEF_CONSOLE_CMD(ConResetCompany)
   659 DEF_CONSOLE_CMD(ConResetCompany)
   660 {
   660 {
   661 	Player *p;
   661 	const Player *p;
   662 	NetworkClientState *cs;
   662 	const NetworkClientState *cs;
   663 	NetworkClientInfo *ci;
   663 	const NetworkClientInfo *ci;
   664 	byte index;
   664 	PlayerID index;
   665 
   665 
   666 	if (argc == 0) {
   666 	if (argc == 0) {
   667 		IConsoleHelp("Remove an idle company from the game. Usage: 'reset_company <company-id>'");
   667 		IConsoleHelp("Remove an idle company from the game. Usage: 'reset_company <company-id>'");
   668 		IConsoleHelp("For company-id's, see the list of companies from the dropdown menu. Player 1 is 1, etc.");
   668 		IConsoleHelp("For company-id's, see the list of companies from the dropdown menu. Player 1 is 1, etc.");
   669 		return true;
   669 		return true;
   719 	if (argc == 0) {
   719 	if (argc == 0) {
   720 		IConsoleHelp("Get a list of connected clients including their ID, name, company-id, and IP. Usage: 'clients'");
   720 		IConsoleHelp("Get a list of connected clients including their ID, name, company-id, and IP. Usage: 'clients'");
   721 		return true;
   721 		return true;
   722 	}
   722 	}
   723 
   723 
   724 	for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) {
   724 	FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
   725 		if (ci->client_index != NETWORK_EMPTY_INDEX) {
   725 		IConsolePrintF(8, "Client #%1d  name: '%s'  company: %1d  IP: %s",
   726 			IConsolePrintF(8, "Client #%1d  name: '%s'  company: %1d  IP: %s",
   726 		               ci->client_index, ci->client_name,
   727 			               ci->client_index, ci->client_name,
   727 		               ci->client_playas + (IsValidPlayer(ci->client_playas) ? 1 : 0),
   728 			               ci->client_playas + (IsValidPlayer(ci->client_playas) ? 1 : 0),
   728 		               GetPlayerIP(ci));
   729 			               GetPlayerIP(ci));
       
   730 		}
       
   731 	}
   729 	}
   732 
   730 
   733 	return true;
   731 	return true;
   734 }
   732 }
   735 
   733 
   746 		IConsoleHelp("Player #255 is spectator all others are a certain company with Company 1 being #1");
   744 		IConsoleHelp("Player #255 is spectator all others are a certain company with Company 1 being #1");
   747 		return true;
   745 		return true;
   748 	}
   746 	}
   749 
   747 
   750 	if (argc < 2) return false;
   748 	if (argc < 2) return false;
   751 
   749 	if (_networking) NetworkDisconnect(); // we are in network-mode, first close it!
   752 	if (_networking) // We are in network-mode, first close it!
       
   753 		NetworkDisconnect();
       
   754 
   750 
   755 	ip = argv[1];
   751 	ip = argv[1];
   756 	/* Default settings: default port and new company */
   752 	/* Default settings: default port and new company */
   757 	rport = NETWORK_DEFAULT_PORT;
   753 	rport = NETWORK_DEFAULT_PORT;
   758 	_network_playas = PLAYER_NEW_COMPANY;
   754 	_network_playas = PLAYER_NEW_COMPANY;