Exemple #1
0
//*****************************************************************************
//
int SERVER_FindClientWithSessionID ( const int SessionID )
{
	for ( int i = 0; i < MAXPLAYERS; ++i )
	{
		if ( SERVER_IsValidClient ( i ) == false )
			continue;

		if ( SERVER_GetClient(i)->SRPsessionID == SessionID )
			return i;
	}
	return MAXPLAYERS;
}
Exemple #2
0
//*****************************************************************************
//
int SERVER_FindClientWithUsername ( const char *Username )
{
	for ( int i = 0; i < MAXPLAYERS; ++i )
	{
		if ( SERVER_IsValidClient ( i ) == false )
			continue;

		if ( SERVER_GetClient(i)->username.CompareNoCase ( Username ) == 0 )
			return i;
	}
	return MAXPLAYERS;
}
Exemple #3
0
void UNLAGGED_SpawnDebugActors ( )
{
	const PClass *pType = PClass::FindClass( "UnlaggedDebugActor" );
	if ( pType == NULL )
		I_FatalError( "To spawn unlagged debug actors a DECORATE actor called \"UnlaggedDebugActor\" needs to be defined!\n" );

	// [BB] Since there is no function that lets the server instruct a client to spawn an actor
	// of a certain type at a specified position without actually having such an actor at that
	// position (and I don't feel like adding such a thing just for this debug function) we
	// create and move a dummy actor here.
	AActor *pActor = Spawn( pType, 0, 0, 0, NO_REPLACE );
	if ( pActor )
	{
		for ( ULONG ulPlayer = 0; ulPlayer < MAXPLAYERS; ++ulPlayer )
		{
			if ( SERVER_IsValidClient( ulPlayer ) == false )
				continue;

			const int unlaggedGametic = UNLAGGED_Gametic( &players[ulPlayer] );

			if ( unlaggedGametic == gametic )
				continue;

			const int unlaggedIndex = unlaggedGametic % UNLAGGEDTICS;

			for ( ULONG ulIdx = 0; ulIdx < MAXPLAYERS; ++ulIdx )
			{
				if ( ( ulPlayer == ulIdx ) || ( PLAYER_IsValidPlayer ( ulIdx ) == false ) || players[ulIdx].bSpectating )
					continue;

				pActor->x = players[ulIdx].unlaggedX[unlaggedIndex];
				pActor->y = players[ulIdx].unlaggedY[unlaggedIndex];
				pActor->z = players[ulIdx].unlaggedZ[unlaggedIndex];

				SERVERCOMMANDS_SpawnThingNoNetID( pActor, ulPlayer, SVCF_ONLYTHISCLIENT );
			}
		}
		// [BB] Get rid ot the dummy actor.
		pActor->Destroy();
	}
}
Exemple #4
0
//*****************************************************************************
//
ULONG CALLVOTE_CountNumEligibleVoters( void )
{
	ULONG	ulIdx;
	ULONG	ulIdx2;
	ULONG	ulNumVoters;

	ulNumVoters = 0;
	for ( ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ )
	{
		// A voter is anyone in the game who isn't a bot.
		if (( playeringame[ulIdx] ) &&
			( players[ulIdx].bIsBot == false ))
		{
			// Go through and see if anyone has an IP that matches this person's.
			if ( NETWORK_GetState( ) == NETSTATE_SERVER )
			{
				for ( ulIdx2 = ulIdx; ulIdx2 < MAXPLAYERS; ulIdx2++ )
				{
					if (( playeringame[ulIdx2] == false ) ||
						( ulIdx == ulIdx2 ) ||
						( SERVER_IsValidClient( ulIdx2 ) == false ))
					{
						continue;
					}

					// If the two IP addresses match, break out.
//					if ( NETWORK_CompareAddress( SERVER_GetClient( ulIdx )->Address, SERVER_GetClient( ulIdx2 )->Address, true ))
//						break;
				}

				if ( ulIdx2 == MAXPLAYERS )
					ulNumVoters++;
			}
			else
				ulNumVoters++;
		}
	}

	return ( ulNumVoters );
}