Sidecar fix to the CardView change: running the test suite revealed a few other places where bad assumptions were being made that an event's card view pointer was legitimate. Now they properly evaluate whether the view is null and adjust accordingly.

This commit is contained in:
wrenczes@gmail.com
2010-12-16 09:41:14 +00:00
parent 87909bed08
commit 1cc516193e
2 changed files with 13 additions and 3 deletions

View File

@@ -451,7 +451,11 @@ int GuiCombat::receiveEventPlus(WEvent* e)
{
if (NULL == event->after)
return 0;
AttackerDamaged* t = NEW AttackerDamaged(event->card, *(event->card->view), true, NULL);
Pos pos(0, 0, 0, 0, 255);
if (event->card->view != NULL)
pos = *event->card->view;
AttackerDamaged* t = NEW AttackerDamaged(event->card, pos, true, NULL);
attackers.push_back(t);
return 1;
}
@@ -460,7 +464,11 @@ int GuiCombat::receiveEventPlus(WEvent* e)
for (inner_iterator it = attackers.begin(); it != attackers.end(); ++it)
if ((*it)->card == event->after)
{
DefenserDamaged* t = NEW DefenserDamaged(event->card, *(event->card->view), true, NULL);
Pos pos(0, 0, 0, 0, 255);
if (event->card->view != NULL)
pos = *event->card->view;
DefenserDamaged* t = NEW DefenserDamaged(event->card, pos, true, NULL);
t->y = t->actY = TOP_LINE;
t->actT = t->t = 0;
t->actZ = t->zoom = kZoom_level2;

View File

@@ -339,8 +339,10 @@ int GuiPlay::receiveEventPlus(WEvent * e)
{
if (CardView* cv = dynamic_cast<CardView*>(event->card->view))
cv->t = event->after ? M_PI / 2 : 0;
else
else if (event->card->view != NULL)
{
event->card->view->actT = event->after ? M_PI / 2 : 0;
}
return 1;
}
else if (WEventPhaseChange *event = dynamic_cast<WEventPhaseChange*>(e))