- Fix for issue 660 (changelings have become slower)
-- I removed the string comparison, which was expensive (the test is not necessary anymore, since it was "shielding" us from fake types (names), which are not creature subtypes, and therefore do not go through). I also moved one function call outside of the loop, just in case that wasn't optimized by the compiler. - Removed unused Subtypes.cpp function (I don't really want people to use it, it can be quite expensive if used incorrectly) - moved a test for issue 501 that has been fixed a while ago (we forgot to add the test to the test suite)
This commit is contained in:
@@ -2426,18 +2426,12 @@ ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * t
|
||||
|
||||
if (stypes.find("allsubtypes") != string::npos || stypes.find("removecreaturesubtypes") != string::npos)
|
||||
{
|
||||
for (size_t i = 0; i <Subtypes::subtypesList->getValuesById().size(); ++i)
|
||||
const vector<string> values = Subtypes::subtypesList->getValuesById();
|
||||
for (size_t i = 0; i <values.size(); ++i)
|
||||
{
|
||||
if (!Subtypes::subtypesList->isSubtypeOfType(i,Subtypes::TYPE_CREATURE))
|
||||
continue;
|
||||
|
||||
//Erwan 2011/5/6 String comparison is expensive. Any way to do this in a cleaner way?
|
||||
//this check is related to targetchooser instances of cards dynamically loaded subtypes.
|
||||
//example(foreach(arbor elf)) adds this as a subtype for list ment.
|
||||
//TODO find cheaper method
|
||||
string s = Subtypes::subtypesList->find(i);
|
||||
if (s.find(" ") != string::npos)
|
||||
continue;
|
||||
types.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user