moved the readding of types below the removel of abilities incase a becomes would be used as a newability.
2nd, found a infinate loop is created when you cast a loseabilities on a card which has loseabilities, when the 2 effect ends it readds the first one, before it is removed, making the first one remove the 2nd one and repeat forever.... this is only a half fix, it created a memleak in the place of the loop :/ so wololo please review!!!
This commit is contained in:
@@ -2662,13 +2662,6 @@ int ATransformer::destroy()
|
|||||||
_target->setColor(*it);
|
_target->setColor(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remove)
|
|
||||||
{
|
|
||||||
for (it = oldtypes.begin(); it != oldtypes.end(); it++)
|
|
||||||
{
|
|
||||||
_target->addType(*it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(newpowerfound )
|
if(newpowerfound )
|
||||||
{
|
{
|
||||||
_target->power = oldpower;
|
_target->power = oldpower;
|
||||||
@@ -2688,7 +2681,14 @@ int ATransformer::destroy()
|
|||||||
newAbilities.erase(_target);
|
newAbilities.erase(_target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//we reset the name in the case that we removed or added types to a card, so that it retains its original name when the effect is removed.
|
if (remove)
|
||||||
|
{
|
||||||
|
for (it = oldtypes.begin(); it != oldtypes.end(); it++)
|
||||||
|
{
|
||||||
|
_target->addType(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//n the case that we removed or added types to a card, so that it retains its original name when the effect is removed.
|
||||||
_target->name.clear();
|
_target->name.clear();
|
||||||
_target->setName(_target->model->data->name.c_str());
|
_target->setName(_target->model->data->name.c_str());
|
||||||
}
|
}
|
||||||
@@ -2853,12 +2853,21 @@ int ALoseAbilities::destroy()
|
|||||||
MTGAbility * a = storedAbilities[i];
|
MTGAbility * a = storedAbilities[i];
|
||||||
//OneShot abilities are not supposed to stay in the game for long.
|
//OneShot abilities are not supposed to stay in the game for long.
|
||||||
// If we copied one, something wrong probably happened
|
// If we copied one, something wrong probably happened
|
||||||
if (a->oneShot)
|
ALoseAbilities * la = dynamic_cast<ALoseAbilities*> (a);
|
||||||
{
|
if (a->oneShot||la)
|
||||||
DebugTrace("ALL_ABILITIES: Ability should not be one shot");
|
{
|
||||||
continue;
|
if(la)
|
||||||
}
|
{
|
||||||
a->addToGame();
|
DebugTrace("Dangerous chance of infinate loop avoided!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DebugTrace("ALLABILITIES: Ability should not be one shot");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a->addToGame();
|
||||||
}
|
}
|
||||||
storedAbilities.clear();
|
storedAbilities.clear();
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user