- Subtypes "getValuesById" now returns a reference

- Minor cleanup of Transformer per one of my comments a few days ago.
This commit is contained in:
wagic.the.homebrew
2011-05-16 23:19:08 +00:00
parent 39420a911f
commit 480875d57a
3 changed files with 6 additions and 9 deletions

View File

@@ -46,7 +46,7 @@ public:
bool isType(unsigned int type);
bool isSubType(unsigned int type);
int add(string value, unsigned int parentType);
const vector<string> getValuesById();
const vector<string>& getValuesById();
};
#endif

View File

@@ -2427,9 +2427,9 @@ ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * t
if (stypes.find("allsubtypes") != string::npos || stypes.find("removecreaturesubtypes") != string::npos)
{
const vector<string> values = Subtypes::subtypesList->getValuesById();
for (size_t i = 0; i <values.size(); ++i)
{
if (!Subtypes::subtypesList->isSubtypeOfType(i,Subtypes::TYPE_CREATURE))
for (size_t i = 0; i <values.size(); ++i)
{
if (!Subtypes::subtypesList->isSubtypeOfType(i,Subtypes::TYPE_CREATURE))
continue;
types.push_back(i);
@@ -2684,10 +2684,7 @@ int ATransformer::destroy()
}
//in the case that we removed or added types to a card, so that it retains its original name when the effect is removed.
if(_target->model->data->name.size())//tokens don't have a model name.
{
_target->name.clear();
_target->setName(_target->model->data->name.c_str());
}
_target->setName(_target->model->data->name.c_str());
}
return 1;
}

View File

@@ -95,7 +95,7 @@ bool Subtypes::isSubType(unsigned int type)
return (!isSuperType(type) && !isType(type));
}
const vector<string> Subtypes::getValuesById()
const vector<string>& Subtypes::getValuesById()
{
return valuesById;
}