fixed a crash with flip cards. how does the test for this pass?

This commit is contained in:
omegablast2002@yahoo.com
2013-05-01 00:02:42 +00:00
parent 305bdb386b
commit 83ef3aa08c
2 changed files with 10 additions and 6 deletions

View File

@@ -1763,7 +1763,7 @@ int AAFlip::resolve()
if (a->oneShot) if (a->oneShot)
{ {
a->resolve(); a->resolve();
delete (a); SAFE_DELETE(a);
} }
else else
{ {
@@ -1823,7 +1823,9 @@ int AAFlip::testDestroy()
if(_target->isFlipped) if(_target->isFlipped)
{ {
this->forceDestroy = 1; this->forceDestroy = 1;
_target->getObserver()->removeObserver(this); //_target->getObserver()->removeObserver(this);
//originally added as a safegaurd to insure the ability was removed
//it's been so long and so much has changed that it appears to do nothing but cause a crash now
_target->isFlipped = false; _target->isFlipped = false;
return 1; return 1;
} }

View File

@@ -691,20 +691,22 @@ void GameStateDuel::Update(float dt)
case DUEL_STATE_CHOOSE_DECK2_TO_PLAY: case DUEL_STATE_CHOOSE_DECK2_TO_PLAY:
if (mParent->players[1] == PLAYER_TYPE_HUMAN) if (mParent->players[1] == PLAYER_TYPE_HUMAN)
{ {
if (deckmenu->isClosed()) if (deckmenu && deckmenu->isClosed())
setGamePhase(DUEL_STATE_PLAY); setGamePhase(DUEL_STATE_PLAY);
else else
deckmenu->Update(dt); if(deckmenu)
deckmenu->Update(dt);
} }
else else
{ {
if (opponentMenu->isClosed()) if (opponentMenu && opponentMenu->isClosed())
{ {
setGamePhase(DUEL_STATE_PLAY); setGamePhase(DUEL_STATE_PLAY);
SAFE_DELETE(opponentMenu); SAFE_DELETE(opponentMenu);
} }
else else
opponentMenu->Update(dt); if(opponentMenu)
opponentMenu->Update(dt);
} }
break; break;
// this called after each match and tournament // this called after each match and tournament