Hid Subtypes behind MTGAllCards and added a mutex to be able to use both singleton from several threads.

This commit is contained in:
Xawotihs@gmail.com
2012-02-12 22:20:05 +00:00
parent ebc4eb331f
commit bd1afebbea
15 changed files with 74 additions and 54 deletions
+4 -4
View File
@@ -2978,10 +2978,10 @@ ATransformer::ATransformer(GameObserver* observer, int id, MTGCardInstance * sou
if (stypes.find("allsubtypes") != string::npos || stypes.find("removecreaturesubtypes") != string::npos)
{
const vector<string> values = Subtypes::subtypesList->getValuesById();
const vector<string> values = MTGAllCards::getValuesById();
for (size_t i = 0; i <values.size(); ++i)
{
if (!Subtypes::subtypesList->isSubtypeOfType(i,Subtypes::TYPE_CREATURE))
if (!MTGAllCards::isSubtypeOfType(i,Subtypes::TYPE_CREATURE))
continue;
types.push_back(i);
@@ -3482,7 +3482,7 @@ int ALoseSubtypes::addToGame()
for (int i = ((int)_target->types.size())-1; i >= 0; --i)
{
int subtype = _target->types[i];
if (Subtypes::subtypesList->isSubtypeOfType(subtype, parentType))
if (MTGAllCards::isSubtypeOfType(subtype, parentType))
{
storedSubtypes.push_back(subtype);
_target->removeType(subtype);
@@ -4506,7 +4506,7 @@ void PopulateSubtypesIndexVector(list<int>& types, const string& subTypesStringL
for (vector<string>::iterator it = subTypesList.begin(); it != subTypesList.end(); ++it)
{
string subtype = *it;
size_t id = Subtypes::subtypesList->find(subtype);
size_t id = MTGAllCards::findType(subtype);
if (id != string::npos)
types.push_back(id);
}