示例#1
0
int KickPlayer (int bBan)
{
	int i, name_index = 5 - bBan;
	const char *pszKick = GT (589 + bBan);

if (strlen (gameData.multigame.msg.szMsg) > 5)
	while (gameData.multigame.msg.szMsg [name_index] == ' ')
		name_index++;

if (!NetworkIAmMaster ()) {
	HUDInitMessage (TXT_KICK_RIGHTS, gameData.multiplayer.players [NetworkWhoIsMaster ()].callsign, pszKick);
	MultiSendMsgQuit ();
	return 1;
	}
if (strlen (gameData.multigame.msg.szMsg) <= (size_t) name_index) {
	HUDInitMessage (TXT_KICK_NAME, pszKick);
	MultiSendMsgQuit ();
	return 1;
	}

if (gameData.multigame.msg.szMsg [name_index] == '#' && ::isdigit (gameData.multigame.msg.szMsg [name_index+1])) {
	int players [MAX_PLAYERS];
	int listpos = gameData.multigame.msg.szMsg [name_index+1] - '0';

	if (gameData.multigame.kills.bShowList == 1 || gameData.multigame.kills.bShowList == 2) {
		if (listpos == 0 || listpos  >= gameData.multiplayer.nPlayers) {
			HUDInitMessage (TXT_KICK_PLR, pszKick);
			MultiSendMsgQuit ();
			return 1;
			}
		MultiGetKillList (players);
		i = players [listpos];
		if ((i != gameData.multiplayer.nLocalPlayer) && (gameData.multiplayer.players [i].connected))
			goto kick_player;
		}
	else 
		HUDInitMessage (TXT_KICK_NUMBER, pszKick);
	MultiSendMsgQuit ();
	return 1;
	}

for (i = 0; i < gameData.multiplayer.nPlayers; i++)
	if ((!strnicmp (gameData.multiplayer.players [i].callsign, &gameData.multigame.msg.szMsg [name_index], strlen (gameData.multigame.msg.szMsg)-name_index)) && (i != gameData.multiplayer.nLocalPlayer) && (gameData.multiplayer.players [i].connected)) {
kick_player:;
		if (gameStates.multi.nGameType  >= IPX_GAME)
			NetworkDumpPlayer (
				netPlayers.m_info.players [i].network.ipx.server, 
				netPlayers.m_info.players [i].network.ipx.node, 
				7);

		HUDInitMessage (TXT_DUMPING, gameData.multiplayer.players [i].callsign);
		if (bBan)
			banList.Add (gameData.multiplayer.players [i].callsign);
		MultiSendMsgQuit ();
		return 1;
		}
return 0;
}
示例#2
0
文件: multimsg.c 项目: paud/d2x-xl
void MultiDefineMacroEnd ()
{
Assert (gameData.multigame.msg.bDefining > 0);
strcpy (gameData.multigame.msg.szMacro [gameData.multigame.msg.bDefining-1], gameData.multigame.msg.szMsg);
WritePlayerFile ();
MultiSendMsgQuit ();
}
示例#3
0
文件: multimsg.c 项目: paud/d2x-xl
void MultiSendMsgEnd ()
{
gameData.multigame.msg.nReceiver = 100;
if (!strnicmp (gameData.multigame.msg.szMsg, TXT_NAMES_OFF, 6)) {
	bNameReturning = 1-bNameReturning;
	HUDInitMessage (TXT_NAMERET, bNameReturning? TXT_NR_ACTIVE : TXT_NR_DISABLED);
	}
else if (!strnicmp (gameData.multigame.msg.szMsg, TXT_HANDICAP, 9)) {
	if (HandicapPlayer ())
		return;
	}
else if (!strnicmp (gameData.multigame.msg.szMsg, TXT_BOMBS_OFF, 7))
	netGame.DoSmartMine = 0;
else if (!(gameStates.render.cockpit.bShowPingStats || strnicmp (gameData.multigame.msg.szMsg, TXT_PING, 5))) {
	if (PingPlayer (-1))
		return;
	}
else if (!strnicmp (gameData.multigame.msg.szMsg, TXT_MOVE, 5)) {
	if (MovePlayer ())
		return;
	}
else if (!strnicmp (gameData.multigame.msg.szMsg, TXT_KICK, 5) && (gameData.app.nGameMode & GM_NETWORK)) {
	if (KickPlayer (0))
		return;
	}
else if (!strnicmp (gameData.multigame.msg.szMsg, TXT_BAN, 4) && (gameData.app.nGameMode & GM_NETWORK)) {
	if (KickPlayer (1))
		return;
	}
else
	HUDInitMessage ("%s '%s'", TXT_SENDING, gameData.multigame.msg.szMsg);
MultiSendMessage ();
MultiMessageFeedback ();
MultiSendMsgQuit ();
}
示例#4
0
文件: multimsg.c 项目: paud/d2x-xl
int PingPlayer (int i)
{
if (gameData.app.nGameMode & GM_NETWORK) {
	if (i  >= 0) {
		pingStats [i].launchTime = TimerGetFixedSeconds ();
		NetworkSendPing ((ubyte) i);
		MultiSendMsgQuit ();
		pingStats [i].sent++;
		}
	else {
		int name_index = 5;
		if (strlen (gameData.multigame.msg.szMsg) > 5)
			while (gameData.multigame.msg.szMsg [name_index] == ' ')
				name_index++;
		if (strlen (gameData.multigame.msg.szMsg) <= (size_t) name_index) {
			HUDInitMessage (TXT_PING_NAME);
			return 1;
			}
		for (i = 0; i < gameData.multiplayer.nPlayers; i++) {
			if ((!strnicmp (gameData.multiplayer.players [i].callsign, &gameData.multigame.msg.szMsg [name_index], strlen (gameData.multigame.msg.szMsg)-name_index)) && 
				 (i != gameData.multiplayer.nLocalPlayer) && (gameData.multiplayer.players [i].connected)) {
				pingStats [i].launchTime = TimerGetFixedSeconds ();
				NetworkSendPing ((ubyte) i);
				HUDInitMessage (TXT_PINGING, gameData.multiplayer.players [i].callsign);
				MultiSendMsgQuit ();
				return 1;
				}
			}
		}
	}
else {// Modem/Serial ping
	pingStats [0].launchTime = TimerGetFixedSeconds ();
	MultiSendModemPing ();
	HUDInitMessage (TXT_PING_OTHER);
	MultiSendMsgQuit ();
	return 1;
	}
return 0;
}
示例#5
0
文件: multimsg.c 项目: paud/d2x-xl
void MultiMsgInputSub (int key)
{
switch (key) {
	case KEY_F8:
	case KEY_ESC:
		MultiSendMsgQuit ();
		GameFlushInputs ();
		break;

	case KEY_LEFT:
	case KEY_BACKSP:
	case KEY_PAD4:
		if (gameData.multigame.msg.nIndex > 0)
			gameData.multigame.msg.nIndex--;
		gameData.multigame.msg.szMsg [gameData.multigame.msg.nIndex] = 0;
		break;

	case KEY_ENTER:
		if (gameData.multigame.msg.bSending)
			MultiSendMsgEnd ();
		else if (gameData.multigame.msg.bDefining)
			MultiDefineMacroEnd ();
		GameFlushInputs ();
		break;

	default:
		if (key > 0) {
			int ascii = KeyToASCII (key);
			if (ascii < 255) {
				if (gameData.multigame.msg.nIndex < MAX_MESSAGE_LEN-2) {
					gameData.multigame.msg.szMsg [gameData.multigame.msg.nIndex++] = ascii;
					gameData.multigame.msg.szMsg [gameData.multigame.msg.nIndex] = 0;
					}
				else if (gameData.multigame.msg.bSending) {
					int i;
					char * ptext, *pcolon;
					ptext = NULL;
					gameData.multigame.msg.szMsg [gameData.multigame.msg.nIndex++] = ascii;
					gameData.multigame.msg.szMsg [gameData.multigame.msg.nIndex] = 0;
					for (i = gameData.multigame.msg.nIndex-1; i >= 0; i--) {
						if (gameData.multigame.msg.szMsg [i] == 32) {
							ptext = &gameData.multigame.msg.szMsg [i+1];
							gameData.multigame.msg.szMsg [i] = 0;
							break;
							}
						}
					MultiSendMsgEnd ();
					if (ptext) {
						gameData.multigame.msg.bSending = 1;
						pcolon = strchr (gameData.multigame.msg.szMsg, ':');
						if (pcolon)
							strcpy (pcolon+1, ptext);
						else
							strcpy (gameData.multigame.msg.szMsg, ptext);
						gameData.multigame.msg.nIndex = (int) strlen (gameData.multigame.msg.szMsg);
						}
					}
				}
			}
	}
}