Speedup MTGAllCards::countByType a bit

This commit is contained in:
Tobias Loose
2013-11-23 13:00:03 +01:00
parent 9ee44ca091
commit 6f083389c2

View File

@@ -544,12 +544,14 @@ int MTGAllCards::countBySet(int setId)
//TODO more efficient way ?
int MTGAllCards::countByType(const string &_type)
{
int type_id = findType(_type);
int result = 0;
map<int, MTGCard *>::iterator it;
for (it = collection.begin(); it != collection.end(); it++)
{
MTGCard * c = it->second;
if (c->data->hasType(_type))
if (c->data->hasType(type_id))
{
result++;
}