Make MTGGameZone::countByType use string instead of char*

and replace strcmp with std::string operator== calls.
This commit is contained in:
Tobias Loose
2013-11-22 18:33:07 +01:00
parent c85d857604
commit 5d0d130587
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ class MTGGameZone {
void cleanupPhase(); void cleanupPhase();
void beforeBeginPhase(); void beforeBeginPhase();
unsigned int countByType(const char * value); unsigned int countByType(const string &value);
unsigned int countByCanTarget(TargetChooser * tc); unsigned int countByCanTarget(TargetChooser * tc);
unsigned int countTotalManaSymbols(TargetChooser * tc, int color); unsigned int countTotalManaSymbols(TargetChooser * tc, int color);
MTGCardInstance * findByName(string name); MTGCardInstance * findByName(string name);
+1 -1
View File
@@ -1042,7 +1042,7 @@ void GameObserver::Affinity()
} }
else else
{ {
reduce = card->controller()->game->battlefield->countByType(type.c_str()); reduce = card->controller()->game->battlefield->countByType(type);
} }
for(int i = 0; i < reduce;i++) for(int i = 0; i < reduce;i++)
{ {
+2 -2
View File
@@ -529,7 +529,7 @@ size_t MTGGameZone::getIndex(MTGCardInstance * card)
} }
unsigned int MTGGameZone::countByType(const char * value) unsigned int MTGGameZone::countByType(const string &value)
{ {
int result = 0; int result = 0;
int subTypeId = MTGAllCards::findType(value); int subTypeId = MTGAllCards::findType(value);
@@ -539,7 +539,7 @@ unsigned int MTGGameZone::countByType(const char * value)
{ {
result++; result++;
} }
else if(strcmp(value, "token") == 0 && cards[i]->isToken) else if(value == "token" && cards[i]->isToken)
result++; result++;
} }
return result; return result;