fixed ai mana finding which broke in previous ai changes(maybe during the split or fixing the memleak)

This commit is contained in:
omegablast2002@yahoo.com
2011-09-21 12:12:34 +00:00
parent 807e818e92
commit 4dbe69dacf
2 changed files with 12 additions and 10 deletions

View File

@@ -714,12 +714,11 @@ bool AIPlayerBaka::payTheManaCost(ManaCost * cost, MTGCardInstance * target,vect
clickstream.push(clicks[clicking]);
return true;
}
//clean up temporary "clicks" structure if its content wasn't used above
for(size_t i = 0; i< clicks.size(); ++i)
SAFE_DELETE(clicks[i]);
clicks.clear();
}
//clean up temporary "clicks" structure if its content wasn't used above
for(size_t i = 0; i< clicks.size(); ++i)
SAFE_DELETE(clicks[i]);
clicks.clear();
SAFE_DELETE(paid);
return false;
}
@@ -1724,6 +1723,8 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty
}
if(nextCardToPlay)
{
if(!pMana->canAfford(nextCardToPlay->getManaCost()))
gotPayments = canPayMana(nextCardToPlay,nextCardToPlay->getManaCost());
DebugTrace(" AI wants to play card." << endl
<< "- Next card to play: " << (nextCardToPlay ? nextCardToPlay->name : "None" ) << endl );
}

View File

@@ -84,12 +84,11 @@ bool AIPlayerBakaB::payTheManaCost(ManaCost * cost, MTGCardInstance * target, ve
clickstream.push(clicks[clicking]);
return true;
}
//clean up temporary "clicks" structure if its content wasn't used above
for(size_t i = 0; i< clicks.size(); ++i)
SAFE_DELETE(clicks[i]);
clicks.clear();
}
//clean up temporary "clicks" structure if its content wasn't used above
for(size_t i = 0; i< clicks.size(); ++i)
SAFE_DELETE(clicks[i]);
clicks.clear();
SAFE_DELETE(paid);
return false;
}
@@ -1724,6 +1723,8 @@ MTGCardInstance * AIPlayerBakaB::FindCardToPlay(ManaCost * pMana, const char * t
}
if(nextCardToPlay)
{
if(!pMana->canAfford(nextCardToPlay->getManaCost()))
gotPayments = canPayMana(nextCardToPlay,nextCardToPlay->getManaCost());
DebugTrace(" AI wants to play card." << endl
<< "- Next card to play: " << (nextCardToPlay ? nextCardToPlay->name : "None" ) << endl );
}