src/console_cmds.cpp
changeset 5587 167d9a91ef02
parent 5584 1111b4d36e35
child 5624 6afe9d27430a
equal deleted inserted replaced
5586:2d4126d81ebb 5587:167d9a91ef02
   560 	FOR_ALL_CLIENTS(cs) {
   560 	FOR_ALL_CLIENTS(cs) {
   561 		int lag = NetworkCalculateLag(cs);
   561 		int lag = NetworkCalculateLag(cs);
   562 		const NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs);
   562 		const NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs);
   563 		const char* status;
   563 		const char* status;
   564 
   564 
   565 		status = (cs->status < lengthof(stat_str) ? stat_str[cs->status] : "unknown");
   565 		status = (cs->status < (ptrdiff_t)lengthof(stat_str) ? stat_str[cs->status] : "unknown");
   566 		IConsolePrintF(8, "Client #%1d  name: '%s'  status: '%s'  frame-lag: %3d  company: %1d  IP: %s  unique-id: '%s'",
   566 		IConsolePrintF(8, "Client #%1d  name: '%s'  status: '%s'  frame-lag: %3d  company: %1d  IP: %s  unique-id: '%s'",
   567 			cs->index, ci->client_name, status, lag,
   567 			cs->index, ci->client_name, status, lag,
   568 			ci->client_playas + (IsValidPlayer(ci->client_playas) ? 1 : 0),
   568 			ci->client_playas + (IsValidPlayer(ci->client_playas) ? 1 : 0),
   569 			GetPlayerIP(ci), ci->unique_id);
   569 			GetPlayerIP(ci), ci->unique_id);
   570 	}
   570 	}
   682 		return true;
   682 		return true;
   683 	}
   683 	}
   684 
   684 
   685 	if (argc != 2) return false;
   685 	if (argc != 2) return false;
   686 
   686 
   687 	index = atoi(argv[1]) - 1;
   687 	index = (PlayerID)(atoi(argv[1]) - 1);
   688 
   688 
   689 	/* Check valid range */
   689 	/* Check valid range */
   690 	if (!IsValidPlayer(index)) {
   690 	if (!IsValidPlayer(index)) {
   691 		IConsolePrintF(_icolour_err, "Company does not exist. Company-id must be between 1 and %d.", MAX_PLAYERS);
   691 		IConsolePrintF(_icolour_err, "Company does not exist. Company-id must be between 1 and %d.", MAX_PLAYERS);
   692 		return true;
   692 		return true;
   768 
   768 
   769 	ParseConnectionString(&player, &port, ip);
   769 	ParseConnectionString(&player, &port, ip);
   770 
   770 
   771 	IConsolePrintF(_icolour_def, "Connecting to %s...", ip);
   771 	IConsolePrintF(_icolour_def, "Connecting to %s...", ip);
   772 	if (player != NULL) {
   772 	if (player != NULL) {
   773 		_network_playas = atoi(player);
   773 		_network_playas = (PlayerID)atoi(player);
   774 		IConsolePrintF(_icolour_def, "    player-no: %d", _network_playas);
   774 		IConsolePrintF(_icolour_def, "    player-no: %d", _network_playas);
   775 
   775 
   776 		/* From a user pov 0 is a new player, internally it's different and all
   776 		/* From a user pov 0 is a new player, internally it's different and all
   777 		 * players are offset by one to ease up on users (eg players 1-8 not 0-7) */
   777 		 * players are offset by one to ease up on users (eg players 1-8 not 0-7) */
   778 		if (_network_playas != PLAYER_SPECTATOR) {
   778 		if (_network_playas != PLAYER_SPECTATOR) {