added a check to avoid skipping a gameState update if there are more than 50 items left to resolve in the stack, let run a gameStates check and see if we havent already won.

Exquisite Blood + Sanguine Bond example of the kinds of loops this fixes.
This commit is contained in:
omegablast2002@yahoo.com
2013-02-02 05:43:46 +00:00
parent cca8f1ce4e
commit a8ebaee527

View File

@@ -581,13 +581,17 @@ void GameObserver::gameStateBasedEffects()
{
if(getCurrentTargetChooser() && int(getCurrentTargetChooser()->getNbTargets()) == getCurrentTargetChooser()->maxtargets)
getCurrentTargetChooser()->done = true;
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0)
return;
if (mLayers->actionLayer()->menuObject)
return;
if (getCurrentTargetChooser() || mLayers->actionLayer()->isWaitingForAnswer())
return;
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) <= 50)
{
//if there are more than 50 unresolved actions on the stack, lets allow a gameStates update
//to make sure we are not caught up in a loop, example :Exquisite Blood + Sanguine Bond
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0)
return;
if (mLayers->actionLayer()->menuObject)
return;
if (getCurrentTargetChooser() || mLayers->actionLayer()->isWaitingForAnswer())
return;
}
////////////////////////
//---apply damage-----//
//after combat effects//