From 480875d57af7daa6c7059fadbd928a294354a0b2 Mon Sep 17 00:00:00 2001 From: "wagic.the.homebrew" Date: Mon, 16 May 2011 23:19:08 +0000 Subject: [PATCH] - Subtypes "getValuesById" now returns a reference - Minor cleanup of Transformer per one of my comments a few days ago. --- projects/mtg/include/Subtypes.h | 2 +- projects/mtg/src/AllAbilities.cpp | 11 ++++------- projects/mtg/src/Subtypes.cpp | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/projects/mtg/include/Subtypes.h b/projects/mtg/include/Subtypes.h index 426e7d9eb..ebcefb29e 100644 --- a/projects/mtg/include/Subtypes.h +++ b/projects/mtg/include/Subtypes.h @@ -46,7 +46,7 @@ public: bool isType(unsigned int type); bool isSubType(unsigned int type); int add(string value, unsigned int parentType); - const vector getValuesById(); + const vector& getValuesById(); }; #endif diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 907cd4281..52fcb4cd3 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -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 values = Subtypes::subtypesList->getValuesById(); - for (size_t i = 0; i isSubtypeOfType(i,Subtypes::TYPE_CREATURE)) + for (size_t i = 0; i 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; } diff --git a/projects/mtg/src/Subtypes.cpp b/projects/mtg/src/Subtypes.cpp index dfdd8b2c0..e1d155293 100644 --- a/projects/mtg/src/Subtypes.cpp +++ b/projects/mtg/src/Subtypes.cpp @@ -95,7 +95,7 @@ bool Subtypes::isSubType(unsigned int type) return (!isSuperType(type) && !isType(type)); } -const vector Subtypes::getValuesById() +const vector& Subtypes::getValuesById() { return valuesById; } \ No newline at end of file