- fix for issue 113
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-10-24 11:52:55 +00:00
parent da6d650c3d
commit fb52ea5452
2 changed files with 22 additions and 12 deletions

View File

@@ -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;
}

View File

@@ -155,10 +155,20 @@ bool GuiGameZone::CheckUserInput(u32 key){
}
void GuiGameZone::Update(float dt){
for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it)
(*it)->Update(dt);
if (showCards) cd->Update(dt);
PlayGuiObject::Update(dt);
for (vector<CardView*>::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){