- 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:
@@ -173,23 +173,14 @@ void MTGCardInstance::initMTGCI()
|
||||
|
||||
if (basicAbilities[(int)Constants::CHANGELING])
|
||||
{//if the card is a changeling, it gains all creature subtypes
|
||||
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 (hasSubtype(i))
|
||||
continue;
|
||||
|
||||
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;
|
||||
|
||||
addType(i);
|
||||
//Don' want to send any event to the gameObserver inside of initMCGI, so calling the parent addType method instead of mine
|
||||
CardPrimitive::addType(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user