extensions/tf2/conditions.cpp
changeset 3719 eda1f57e79b0
parent 3332 e0af1cba759f
child 3720 8048e61b5382
     1.1 --- a/extensions/tf2/conditions.cpp	Thu Dec 20 18:24:47 2012 -0500
     1.2 +++ b/extensions/tf2/conditions.cpp	Fri Dec 21 01:17:30 2012 -0500
     1.3 @@ -48,6 +48,8 @@
     1.4  
     1.5  bool g_bIgnoreRemove;
     1.6  
     1.7 +#define MAX_CONDS (sizeof(uint64_t) * 8)
     1.8 +
     1.9  inline condflags_t GetPlayerConds(CBaseEntity *pPlayer)
    1.10  {
    1.11  	uint32_t playerCond   =  *(uint32_t *)((intptr_t)pPlayer + playerCondOffset);
    1.12 @@ -92,25 +94,25 @@
    1.13  		addedconds = newconds &~ oldconds;
    1.14  		removedconds = oldconds &~ newconds;
    1.15  
    1.16 -		int j;
    1.17 +		uint64_t j;
    1.18  		condflags_t bit;
    1.19  
    1.20 -		for (j = 0; (bit = ((condflags_t)1 << j)) <= addedconds; j++)
    1.21 +		for (j = 0; j < MAX_CONDS && (bit = ((condflags_t)1 << j)) <= addedconds; j++)
    1.22  		{
    1.23  			if ((addedconds & bit) == bit)
    1.24  			{
    1.25  				g_addCondForward->PushCell(i);
    1.26 -				g_addCondForward->PushCell(j);
    1.27 +				g_addCondForward->PushCell(j & 0xFFFFFFFF);
    1.28  				g_addCondForward->Execute(NULL, NULL);
    1.29  			}
    1.30  		}
    1.31  
    1.32 -		for (j = 0; (bit = ((condflags_t)1 << j)) <= removedconds; j++)
    1.33 +		for (j = 0; j < MAX_CONDS && (bit = ((condflags_t)1 << j)) <= removedconds; j++)
    1.34  		{
    1.35  			if ((removedconds & bit) == bit)
    1.36  			{
    1.37  				g_removeCondForward->PushCell(i);
    1.38 -				g_removeCondForward->PushCell(j);
    1.39 +				g_removeCondForward->PushCell(j & 0xFFFFFFFF);
    1.40  				g_removeCondForward->Execute(NULL, NULL);
    1.41  			}
    1.42  		}