diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index c74b0bc06..44c99b139 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -503,6 +503,8 @@ int MTGRevealingCards::receiveEvent(WEvent* e) CardView* t; if (event->card->view) t = NEW CardView(CardView::nullZone, event->card, *(event->card->view)); + else + t = NEW CardView(CardView::nullZone, event->card, (float)x, (float)y); //we store copies of the card view since moving to and from card displays also deletes the guis stored in cards. //GuiLayer::resetObjects() is the main reason we need to back them up. card views are set to NULL maybe more often than //they should be, possibly someone being to over cautious. @@ -510,6 +512,7 @@ int MTGRevealingCards::receiveEvent(WEvent* e) t->actY = SCREEN_HEIGHT * -2; //correct cards x and y, last known location was the reveal display. cards.push_back(t); + return 1; } } return 0; @@ -832,6 +835,8 @@ int MTGScryCards::receiveEvent(WEvent* e) CardView* t; if (event->card->view) t = NEW CardView(CardView::nullZone, event->card, *(event->card->view)); + else + t = NEW CardView(CardView::nullZone, event->card, (float)x, (float)y); //we store copies of the card view since moving to and from card displays also deletes the guis stored in cards. //GuiLayer::resetObjects() is the main reason we need to back them up. card views are set to NULL maybe more often than //they should be, possibly someone being to over cautious. @@ -839,6 +844,7 @@ int MTGScryCards::receiveEvent(WEvent* e) t->actY = SCREEN_HEIGHT * -2; //correct cards x and y, last known location was the reveal display. cards.push_back(t); + return 1; } } return 0; @@ -4298,19 +4304,19 @@ ABestow::ABestow(GameObserver* observer, int id, MTGCardInstance * card, MTGCard _card = card; } -int ABestow::resolve() -{ - if (target) - { - if (_card->hasType("creature")) - { - _card->removeType("creature"); - _card->addType("aura"); - } - _card->target = (MTGCardInstance*)target; - _card->isBestowed = true; - } - return 1; +int ABestow::resolve() +{ + if (target) + { + if (_card->hasType("creature")) + { + _card->removeType("creature"); + _card->addType("aura"); + } + _card->target = (MTGCardInstance*)target; + _card->isBestowed = true; + } + return 1; } const string ABestow::getMenuText() diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 908ce9606..f3c4bf2ab 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -32,7 +32,8 @@ void GameObserver::cleanup() SAFE_DELETE(replacementEffects); for (size_t i = 0; i < players.size(); ++i) { - SAFE_DELETE(players[i]); + if(players[i]) + SAFE_DELETE(players[i]); } players.clear(); @@ -60,7 +61,8 @@ GameObserver::~GameObserver() for (size_t i = 0; i < players.size(); ++i) { - players[i]->End(); + if(players[i]) + players[i]->End(); } SAFE_DELETE(targetChooser); SAFE_DELETE(mLayers); @@ -68,7 +70,8 @@ GameObserver::~GameObserver() SAFE_DELETE(replacementEffects); for (size_t i = 0; i < players.size(); ++i) { - SAFE_DELETE(players[i]); + if(players[i]) + SAFE_DELETE(players[i]); } players.clear(); delete[] ExtraRules;