From ac992675da2ee5a58af675016ddaff98e03aabe8 Mon Sep 17 00:00:00 2001 From: "techdragon.nguyen@gmail.com" Date: Wed, 1 Feb 2012 04:17:30 +0000 Subject: [PATCH] This removes the compilation error introduced with r4237. I needed this in place to make an iOS build. --- projects/mtg/include/AIPlayerBaka.h | 3 ++- projects/mtg/include/AIPlayerBakaB.h | 3 --- projects/mtg/src/AIPlayerBaka.cpp | 21 +++++++++++++++------ projects/mtg/src/AIPlayerBakaB.cpp | 13 ------------- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/projects/mtg/include/AIPlayerBaka.h b/projects/mtg/include/AIPlayerBaka.h index b3e003d16..99e9a7961 100644 --- a/projects/mtg/include/AIPlayerBaka.h +++ b/projects/mtg/include/AIPlayerBaka.h @@ -81,7 +81,8 @@ class AIPlayerBaka: public AIPlayer{ //Tries to play an ability recommended by the deck creator virtual int selectHintAbility(); - virtual vector canPayMana(MTGCardInstance * card = NULL,ManaCost * mCost = NULL, mapusedCards = map()); + virtual vector canPayMana(MTGCardInstance * card = NULL, ManaCost * mCost = NULL); + virtual vector canPayMana(MTGCardInstance * card, ManaCost * mCost, map &usedCards); virtual vector canPaySunBurst(ManaCost * mCost = NULL); virtual MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0); diff --git a/projects/mtg/include/AIPlayerBakaB.h b/projects/mtg/include/AIPlayerBakaB.h index f41ae68f4..8943578d0 100644 --- a/projects/mtg/include/AIPlayerBakaB.h +++ b/projects/mtg/include/AIPlayerBakaB.h @@ -28,9 +28,6 @@ protected: //Tries to play an ability recommended by the deck creator int selectHintAbility(); - vector canPayMana(MTGCardInstance * card = NULL,ManaCost * mCost = NULL); - vector canPaySunBurst(ManaCost * mCost = NULL); - MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0); int selectMenuOption(); int useAbility(); diff --git a/projects/mtg/src/AIPlayerBaka.cpp b/projects/mtg/src/AIPlayerBaka.cpp index e7ef337cd..38967d1fe 100644 --- a/projects/mtg/src/AIPlayerBaka.cpp +++ b/projects/mtg/src/AIPlayerBaka.cpp @@ -834,19 +834,28 @@ ManaCost * AIPlayerBaka::getPotentialMana(MTGCardInstance * target) return result; } -vector AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost * cost, mapusedCards ) +vector AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost * cost) { - if(!cost || (cost && !cost->getConvertedCost())) + if(!cost || (cost && !cost->getConvertedCost()) || !target) + return vector(); + map usedCards; + + return canPayMana(target, cost, usedCards); +} + +vector AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost * cost, map &used ) +{ + if(!cost->getConvertedCost()) return vector(); ManaCost * result = NEW ManaCost(); - map used = usedCards; + vectorpayments = vector(); if (this->getManaPool()->getConvertedCost()) { //adding the current manapool if any. result->add(this->getManaPool()); } - int needColorConverted = cost->getConvertedCost()-int(cost->getCost(0)+cost->getCost(7)); + int needColorConverted = cost->getConvertedCost() - int(cost->getCost(0)+cost->getCost(7)); int fullColor = 0; for (size_t i = 0; i < observer->mLayers->actionLayer()->manaObjects.size(); i++) { @@ -1007,7 +1016,7 @@ vector AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost * return payments;//we didn't meet one of the color cost requirements. } } - if(cost->kicker && !usedCards.size()) + if(cost->kicker && !used.size()) { ManaCost * withKickerCost= NEW ManaCost(cost->kicker); @@ -1016,7 +1025,7 @@ vector AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost * bool keepLooking = true; while(keepLooking) { - kickerPayment = canPayMana(target,withKickerCost,used); + kickerPayment = canPayMana(target, withKickerCost, used); if(kickerPayment.size()) { for(unsigned int w = 0;w < kickerPayment.size();++w) diff --git a/projects/mtg/src/AIPlayerBakaB.cpp b/projects/mtg/src/AIPlayerBakaB.cpp index 2c9f68b58..67675ab21 100644 --- a/projects/mtg/src/AIPlayerBakaB.cpp +++ b/projects/mtg/src/AIPlayerBakaB.cpp @@ -25,8 +25,6 @@ bool AIPlayerBakaB::payTheManaCost(ManaCost * cost, MTGCardInstance * target, ve return AIPlayerBaka::payTheManaCost(cost, target, gotPayments); } - - int AIPlayerBakaB::getEfficiency(OrderedAIAction * action) { return AIPlayerBaka::getEfficiency(action); @@ -37,17 +35,6 @@ ManaCost * AIPlayerBakaB::getPotentialMana(MTGCardInstance * target) return AIPlayerBaka::getPotentialMana(target); } -vector AIPlayerBakaB::canPayMana(MTGCardInstance * target,ManaCost * cost) -{ - return AIPlayerBaka::canPayMana(target, cost); -} - -vector AIPlayerBakaB::canPaySunBurst(ManaCost * cost) -{ - return AIPlayerBaka::canPaySunBurst(cost); -} - - int AIPlayerBakaB::CanHandleCost(ManaCost * cost) { return AIPlayerBaka::CanHandleCost(cost);