From a2149131fbf59a6217d244d0580b3b3888ea362e Mon Sep 17 00:00:00 2001 From: "wagic.the.homebrew@gmail.com" Date: Sun, 23 Aug 2009 10:48:06 +0000 Subject: [PATCH] Erwan - fix bug eventBlocker --- projects/mtg/src/MTGCardInstance.cpp | 7 +++++-- projects/mtg/src/WEvent.cpp | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 87832eb4f..6b3d1dc7b 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -521,13 +521,16 @@ int MTGCardInstance::setDefenser(MTGCardInstance * opponent){ defenser->blockers.remove(this); } } - WEvent * e = NEW WEventCreatureBlocker(this, defenser, opponent); + WEvent * e = NULL; + if (defenser != opponent){ + e = NEW WEventCreatureBlocker(this, defenser, opponent); + } defenser = opponent; if (defenser){ defenser->blockers.push_back(this); } g->blockersSorted = false; - g->receiveEvent(e); + if (e) g->receiveEvent(e); //delete e; return 1; } diff --git a/projects/mtg/src/WEvent.cpp b/projects/mtg/src/WEvent.cpp index 27844179e..8b669ffbe 100644 --- a/projects/mtg/src/WEvent.cpp +++ b/projects/mtg/src/WEvent.cpp @@ -18,7 +18,7 @@ WEventCardTap::WEventCardTap(MTGCardInstance * card, bool before, bool after) : WEventCreatureAttacker::WEventCreatureAttacker(MTGCardInstance * card, Targetable * before, Targetable * after) : WEventCardUpdate(card), before(before), after(after){} -WEventCreatureBlocker::WEventCreatureBlocker(MTGCardInstance * card, MTGCardInstance * from,MTGCardInstance * to) : WEventCardUpdate(card), before(before), after(after){} +WEventCreatureBlocker::WEventCreatureBlocker(MTGCardInstance * card, MTGCardInstance * from,MTGCardInstance * to) : WEventCardUpdate(card), before(from), after(to){} WEventCreatureBlockerRank::WEventCreatureBlockerRank(MTGCardInstance * card, MTGCardInstance * exchangeWith, MTGCardInstance * attacker) : WEventCardUpdate(card), exchangeWith(exchangeWith), attacker(attacker){}