fixed line endingsin AIPlayer.cpp

modified debug output for Manacost.  ToString() wasn't defined correctly.  I refactored the output
for Dump() to just call ToString().
This commit is contained in:
techdragon.nguyen@gmail.com
2010-12-09 01:37:49 +00:00
parent 833bd4714d
commit 36c096a33c
2 changed files with 22 additions and 17 deletions

View File

@@ -441,10 +441,10 @@ int AIAction::getEfficiency()
AbilityFactory af; AbilityFactory af;
int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY); int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY);
int efficiencyModifier = (25 * target->DangerRanking()); int efficiencyModifier = (25 * target->DangerRanking());
if (p->game->hand->nb_cards > 1) if (p->game->hand->nb_cards > 1)
{ {
efficiencyModifier /= p->game->hand->nb_cards; efficiencyModifier /= p->game->hand->nb_cards;
} }
if (suggestion == BAKA_EFFECT_BAD && p != target->controller() && target->has(a->abilitygranted) && p->isAI()) if (suggestion == BAKA_EFFECT_BAD && p != target->controller() && target->has(a->abilitygranted) && p->isAI())
{ {

View File

@@ -424,11 +424,6 @@ int ManaCost::add(ManaCost * _cost)
return 1; return 1;
} }
string ManaCost::toString()
{
return "ManaCost - Todo";
}
int ManaCost::addHybrid(int c1, int v1, int c2, int v2) int ManaCost::addHybrid(int c1, int v1, int c2, int v2)
{ {
ManaCostHybrid * h = NEW ManaCostHybrid(c1, v1, c2, v2); ManaCostHybrid * h = NEW ManaCostHybrid(c1, v1, c2, v2);
@@ -621,24 +616,32 @@ ManaCost * ManaCost::Diff(ManaCost * _cost)
} }
#ifdef WIN32 string ManaCost::toString()
void ManaCost::Dump()
{ {
DebugTrace("\n===ManaCost===\n"); ostringstream oss;
for (int i=0; i<= Constants::MTG_NB_COLORS; i++) oss << "\n===ManaCost===\n";
for (int i = 0; i <= Constants::MTG_NB_COLORS; i++)
{ {
if (cost[i]) if (cost[i])
{ {
DebugTrace(Constants::MTGColorChars[i] << ":" << cost[i] << " - "); oss << Constants::MTGColorChars[i] << ":" << cost[i] << " - ";
} }
} }
for (unsigned int i=0; i< nbhybrids; i++) for (unsigned int i = 0; i < nbhybrids; i++)
{ {
ManaCostHybrid * h = hybrids[i]; ManaCostHybrid * h = hybrids[i];
DebugTrace("H:{" << Constants::MTGColorChars[h->color1] << ":" << h->value1 << "}/{" << Constants::MTGColorChars[h->color2] << ":" << h->value2 << "}"); oss << "H:{" << Constants::MTGColorChars[h->color1] << ":" << h->value1 << "}/{" << Constants::MTGColorChars[h->color2]
<< ":" << h->value2 << "}";
} }
DebugTrace("\n=============\n"); oss << "\n=============\n";
return oss.str();
}
#ifdef WIN32
void ManaCost::Dump()
{
DebugTrace( this->toString() );
} }
#endif #endif
@@ -659,6 +662,7 @@ ManaPool::ManaPool(Player * player) :
ManaCost(), player(player) ManaCost(), player(player)
{ {
} }
ManaPool::ManaPool(ManaCost * _manaCost, Player * player) : ManaPool::ManaPool(ManaCost * _manaCost, Player * player) :
ManaCost(_manaCost), player(player) ManaCost(_manaCost), player(player)
{ {
@@ -701,6 +705,7 @@ int ManaPool::add(ManaCost * _cost, MTGCardInstance * source)
} }
return result; return result;
} }
int ManaPool::pay(ManaCost * _cost) int ManaPool::pay(ManaCost * _cost)
{ {
int current[Constants::MTG_NB_COLORS]; int current[Constants::MTG_NB_COLORS];