fixed issues with "else" support in ifthen.
This commit is contained in:
@@ -3003,7 +3003,7 @@ int IfThenAbility::resolve()
|
|||||||
}
|
}
|
||||||
else if(delayedElseAbility)
|
else if(delayedElseAbility)
|
||||||
{
|
{
|
||||||
delayedElseAbility->clone();
|
a1 = delayedElseAbility->clone();
|
||||||
}
|
}
|
||||||
if (!a1)
|
if (!a1)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3039,6 +3039,7 @@ IfThenAbility * IfThenAbility::clone() const
|
|||||||
IfThenAbility::~IfThenAbility()
|
IfThenAbility::~IfThenAbility()
|
||||||
{
|
{
|
||||||
SAFE_DELETE(delayedAbility);
|
SAFE_DELETE(delayedAbility);
|
||||||
|
SAFE_DELETE(delayedElseAbility);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|||||||
@@ -1208,11 +1208,13 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
{
|
{
|
||||||
string s2 = s.substr(foundElse+6);
|
string s2 = s.substr(foundElse+6);
|
||||||
if(s2.size())
|
if(s2.size())
|
||||||
|
{
|
||||||
s.erase(s.find(" else ")+1);
|
s.erase(s.find(" else ")+1);
|
||||||
a2 = parseMagicLine(s2, id, spell, card);
|
a2 = parseMagicLine(s2, id, spell, card);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
string s1 = s.substr(foundElse+6);
|
string s1 = s;
|
||||||
MTGAbility * a1 = parseMagicLine(s1, id, spell, card);
|
MTGAbility * a1 = parseMagicLine(s1.substr(s1.find(" then "+1)), id, spell, card);
|
||||||
|
|
||||||
if(!a1) return NULL;
|
if(!a1) return NULL;
|
||||||
MTGAbility * a = NEW IfThenAbility(observer, id, a1,a2, card,(Targetable*)target,checkIf[i],cond);
|
MTGAbility * a = NEW IfThenAbility(observer, id, a1,a2, card,(Targetable*)target,checkIf[i],cond);
|
||||||
|
|||||||
Reference in New Issue
Block a user