add some handling of reveal to avoid a crash in demo for AI.
This commit is contained in:
@@ -416,7 +416,10 @@ bool MTGRevealingCards::CheckUserInput(JButton key)
|
||||
{
|
||||
if (this->source->controller() != game->isInterrupting)
|
||||
game->mLayers->stackLayer()->cancelInterruptOffer(ActionStack::DONT_INTERRUPT, false);
|
||||
|
||||
if (key == 0)
|
||||
key = JGE_BTN_NEXT;
|
||||
if (key != JGE_BTN_OK && key != JGE_BTN_NEXT)
|
||||
key = JGE_BTN_OK;
|
||||
}
|
||||
if (JGE_BTN_SEC == key || JGE_BTN_PREV == key || JGE_BTN_NEXT == key || JGE_BTN_MENU == key)//android back button
|
||||
{
|
||||
@@ -431,10 +434,9 @@ bool MTGRevealingCards::CheckUserInput(JButton key)
|
||||
tc->source->getObserver()->cardClick(tc->source, 0, false);
|
||||
//remove the first ability to avoid a menu react.
|
||||
source->getObserver()->mLayers->stackLayer()->Remove(abilityFirst);
|
||||
abilityFirst->removeFromGame();
|
||||
game->removeObserver(abilityFirst);
|
||||
|
||||
|
||||
if (!this->source->controller()->isAI())
|
||||
game->Update(0);
|
||||
|
||||
if (zone->cards.size())//generally only want to add ability 2 if anything is left in the zone.
|
||||
@@ -461,8 +463,8 @@ bool MTGRevealingCards::CheckUserInput(JButton key)
|
||||
if (!tc && !abilitySecond)
|
||||
{
|
||||
source->getObserver()->mLayers->stackLayer()->Remove(abilityFirst);
|
||||
abilityFirst->removeFromGame();
|
||||
game->removeObserver(abilityFirst);
|
||||
if (!this->source->controller()->isAI())
|
||||
game->Update(1);
|
||||
|
||||
if (zone->cards.size())
|
||||
@@ -722,6 +724,10 @@ bool MTGScryCards::CheckUserInput(JButton key)
|
||||
//in the future we will need a way to find out if the human is pressing the keys and which player.
|
||||
if (this->source->controller() != game->isInterrupting)
|
||||
game->mLayers->stackLayer()->cancelInterruptOffer(ActionStack::DONT_INTERRUPT, false);
|
||||
if (key == 0)
|
||||
key = JGE_BTN_NEXT;
|
||||
if (key != JGE_BTN_OK && key != JGE_BTN_NEXT)
|
||||
key = JGE_BTN_OK;
|
||||
}
|
||||
if (JGE_BTN_SEC == key || JGE_BTN_PREV == key || JGE_BTN_NEXT == key || JGE_BTN_MENU == key)
|
||||
{
|
||||
@@ -734,8 +740,8 @@ bool MTGScryCards::CheckUserInput(JButton key)
|
||||
tc->source->getObserver()->cardClick(tc->source, 0, false);
|
||||
//remove the first ability to avoid a menu react.
|
||||
source->getObserver()->mLayers->stackLayer()->Remove(abilityFirst);
|
||||
abilityFirst->removeFromGame();
|
||||
game->removeObserver(abilityFirst);
|
||||
if (!this->source->controller()->isAI())
|
||||
game->Update(0);
|
||||
if (zone->cards.size())
|
||||
{
|
||||
@@ -761,8 +767,8 @@ bool MTGScryCards::CheckUserInput(JButton key)
|
||||
{
|
||||
//remove the first ability to avoid a menu react.
|
||||
source->getObserver()->mLayers->stackLayer()->Remove(abilityFirst);
|
||||
abilityFirst->removeFromGame();
|
||||
game->removeObserver(abilityFirst);
|
||||
if (!this->source->controller()->isAI())
|
||||
game->Update(1);
|
||||
|
||||
if (zone->cards.size() || (revealDisplay && !zone->cards.size()))
|
||||
|
||||
Reference in New Issue
Block a user