# HG changeset patch # User Nicholas Hastings # Date 1356070650 18000 # Node ID eda1f57e79b03c5b917ea44eefb55790e218668f # Parent 1d9b8d0156584789007752403fc00db3a25a9812 Fixed hang in TF2 extension when player condition 63 is added. diff -r 1d9b8d015658 -r eda1f57e79b0 extensions/tf2/conditions.cpp --- a/extensions/tf2/conditions.cpp Thu Dec 20 18:24:47 2012 -0500 +++ b/extensions/tf2/conditions.cpp Fri Dec 21 01:17:30 2012 -0500 @@ -48,6 +48,8 @@ bool g_bIgnoreRemove; +#define MAX_CONDS (sizeof(uint64_t) * 8) + inline condflags_t GetPlayerConds(CBaseEntity *pPlayer) { uint32_t playerCond = *(uint32_t *)((intptr_t)pPlayer + playerCondOffset); @@ -92,25 +94,25 @@ addedconds = newconds &~ oldconds; removedconds = oldconds &~ newconds; - int j; + uint64_t j; condflags_t bit; - for (j = 0; (bit = ((condflags_t)1 << j)) <= addedconds; j++) + for (j = 0; j < MAX_CONDS && (bit = ((condflags_t)1 << j)) <= addedconds; j++) { if ((addedconds & bit) == bit) { g_addCondForward->PushCell(i); - g_addCondForward->PushCell(j); + g_addCondForward->PushCell(j & 0xFFFFFFFF); g_addCondForward->Execute(NULL, NULL); } } - for (j = 0; (bit = ((condflags_t)1 << j)) <= removedconds; j++) + for (j = 0; j < MAX_CONDS && (bit = ((condflags_t)1 << j)) <= removedconds; j++) { if ((removedconds & bit) == bit) { g_removeCondForward->PushCell(i); - g_removeCondForward->PushCell(j); + g_removeCondForward->PushCell(j & 0xFFFFFFFF); g_removeCondForward->Execute(NULL, NULL); } }