Support servers other than 64 slots... theoretically.
This commit is contained in:
		
							parent
							
								
									8b955e85a2
								
							
						
					
					
						commit
						32a6c75292
					
				@ -117,6 +117,7 @@ IForward *g_pOnRunThinkFunctionsPost = NULL;
 | 
			
		||||
 | 
			
		||||
int g_SH_TriggerMoved = 0;
 | 
			
		||||
int g_SH_TouchLinks = 0;
 | 
			
		||||
const int g_iMaxPlayers = 0;
 | 
			
		||||
 | 
			
		||||
CTriggerMoved *g_CTriggerMoved = NULL;
 | 
			
		||||
CTouchLinks *g_CTouchLinks = NULL;
 | 
			
		||||
@ -152,7 +153,7 @@ void (__fastcall *g_pPhysics_SimulateEntity)(CBaseEntity *pEntity) = NULL;
 | 
			
		||||
 | 
			
		||||
void Physics_SimulateEntity_CustomLoop(CBaseEntity **ppList, int Count, float Startime)
 | 
			
		||||
{
 | 
			
		||||
	CBaseEntity *apPlayers[SM_MAXPLAYERS];
 | 
			
		||||
	CBaseEntity *apPlayers[g_iMaxPlayers];
 | 
			
		||||
	int iPlayers = 0;
 | 
			
		||||
 | 
			
		||||
	// Remove players from list and put into apPlayers
 | 
			
		||||
@ -167,7 +168,7 @@ void Physics_SimulateEntity_CustomLoop(CBaseEntity **ppList, int Count, float St
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		int Entity = gamehelpers->IndexOfEdict(pEdict);
 | 
			
		||||
		if(Entity >= 1 && Entity <= SM_MAXPLAYERS)
 | 
			
		||||
		if(Entity >= 1 && Entity <= g_iMaxPlayers)
 | 
			
		||||
		{
 | 
			
		||||
			apPlayers[iPlayers++] = pEntity;
 | 
			
		||||
			ppList[i] = NULL;
 | 
			
		||||
@ -242,7 +243,7 @@ IterationRetval_t TriggerMoved_EnumElement(IHandleEntity *pHandleEntity)
 | 
			
		||||
	int index = hndl.GetEntryIndex();
 | 
			
		||||
 | 
			
		||||
	// We only care about players
 | 
			
		||||
	if(index > SM_MAXPLAYERS)
 | 
			
		||||
	if(index > g_iMaxPlayers)
 | 
			
		||||
	{
 | 
			
		||||
		RETURN_META_VALUE(MRES_IGNORED, ITERATION_CONTINUE);
 | 
			
		||||
	}
 | 
			
		||||
@ -306,13 +307,13 @@ IterationRetval_t TouchLinks_EnumElement(IHandleEntity *pHandleEntity)
 | 
			
		||||
	int index = hndl.GetEntryIndex();
 | 
			
		||||
 | 
			
		||||
	// Optimization: Players shouldn't touch other players
 | 
			
		||||
	if(g_SolidEntityMoved <= SM_MAXPLAYERS && index <= SM_MAXPLAYERS)
 | 
			
		||||
	if(g_SolidEntityMoved <= g_iMaxPlayers && index <= g_iMaxPlayers)
 | 
			
		||||
	{
 | 
			
		||||
		RETURN_META_VALUE(MRES_SUPERCEDE, ITERATION_CONTINUE);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// block solid from touching any clients here if bit is set
 | 
			
		||||
	if(g_pBlockSolidTouchPlayers && index <= SM_MAXPLAYERS && CheckBit(g_pBlockSolidTouchPlayers, g_SolidEntityMoved))
 | 
			
		||||
	if(g_pBlockSolidTouchPlayers && index <= g_iMaxPlayers && CheckBit(g_pBlockSolidTouchPlayers, g_SolidEntityMoved))
 | 
			
		||||
	{
 | 
			
		||||
		RETURN_META_VALUE(MRES_SUPERCEDE, ITERATION_CONTINUE);
 | 
			
		||||
	}
 | 
			
		||||
@ -361,6 +362,8 @@ bool PhysHooks::SDK_OnLoad(char *error, size_t maxlength, bool late)
 | 
			
		||||
{
 | 
			
		||||
	srand((unsigned int)time(NULL));
 | 
			
		||||
 | 
			
		||||
	g_iMaxPlayers = playerhelpers->GetMaxClients();
 | 
			
		||||
 | 
			
		||||
	char conf_error[255] = "";
 | 
			
		||||
	if(!gameconfs->LoadGameConfigFile("PhysHooks.games", &g_pGameConf, conf_error, sizeof(conf_error)))
 | 
			
		||||
	{
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user