diff --git a/projects/mtg/src/GuiPlay.cpp b/projects/mtg/src/GuiPlay.cpp index ce9b3a982..d0b77be67 100644 --- a/projects/mtg/src/GuiPlay.cpp +++ b/projects/mtg/src/GuiPlay.cpp @@ -266,18 +266,18 @@ int GuiPlay::receiveEventMinus(WEvent * e) { if ((game->players[0]->inPlay() == event->from) || (game->players[1]->inPlay() == event->from)) - for (iterator it = cards.begin(); it != cards.end(); ++it) - if (event->card->previous == (*it)->card || event->card == (*it)->card ) - { + for (iterator it = cards.begin(); it != cards.end(); ++it) + if (event->card->previous == (*it)->card || event->card == (*it)->card ) + { if (event->card->previous && event->card->previous->attacker) battleField.removeAttacker(event->card->previous); else if (event->card->attacker) battleField.removeAttacker(event->card); - CardView* cv = *it; - cs->Remove(cv); - cards.erase(it); + CardView* cv = *it; + cs->Remove(cv); + cards.erase(it); trash(cv); - Replace(); - return 1; - } - } + Replace(); + return 1; + } + } return 0; } diff --git a/projects/mtg/src/GuiStatic.cpp b/projects/mtg/src/GuiStatic.cpp index 648a17ac8..e3274fcda 100644 --- a/projects/mtg/src/GuiStatic.cpp +++ b/projects/mtg/src/GuiStatic.cpp @@ -155,10 +155,20 @@ bool GuiGameZone::CheckUserInput(u32 key){ } void GuiGameZone::Update(float dt){ - for (vector::iterator it = cards.begin(); it != cards.end(); ++it) - (*it)->Update(dt); if (showCards) cd->Update(dt); PlayGuiObject::Update(dt); + + for (vector::iterator it = cards.begin(); it != cards.end(); ++it){ + CardView * c = (*it); + c->Update(dt); + + //Dirty fix for http://code.google.com/p/wagic/issues/detail?id=113 + if (fabs(c->actX - c->x) < 0.01 && fabs(c->actY - c->y)< 0.01){ + cards.erase(it); + trash(c); + return; + } + } } GuiGameZone::GuiGameZone(float x, float y, bool hasFocus, MTGGameZone* zone, GuiAvatars* parent): GuiStatic(GuiGameZone::Height, x, y, hasFocus, parent), zone(zone){