Fix off-by-one error with FindNextSetBit in cond checks.

This commit is contained in:
Nicholas Hastings 2014-11-15 11:22:43 -05:00
parent 849df7895b
commit 1cf43b4ec2

View File

@ -107,16 +107,16 @@ void Conditions_OnGameFrame(bool simulating)
CondBitVecAndNot(oldconds, newconds, &removedconds); CondBitVecAndNot(oldconds, newconds, &removedconds);
int bit; int bit;
bit = 0; bit = -1;
while ((bit = addedconds.FindNextSetBit(bit)) != -1) while ((bit = addedconds.FindNextSetBit(bit + 1)) != -1)
{ {
g_addCondForward->PushCell(i); g_addCondForward->PushCell(i);
g_addCondForward->PushCell(bit); g_addCondForward->PushCell(bit);
g_addCondForward->Execute(NULL, NULL); g_addCondForward->Execute(NULL, NULL);
} }
bit = 0; bit = -1;
while ((bit = removedconds.FindNextSetBit(bit)) != -1) while ((bit = removedconds.FindNextSetBit(bit + 1)) != -1)
{ {
g_removeCondForward->PushCell(i); g_removeCondForward->PushCell(i);
g_removeCondForward->PushCell(bit); g_removeCondForward->PushCell(bit);