- removed "image_name" variable from MTGCard. this should free roughly 200kB with the current amount of MTGCard objects we have. (Which counterbalances the "roughly 150kB in Introduced in CardP Primitives recently :( )
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#ifndef _MTGCARD_H_
|
||||
#define _MTGCARD_H_
|
||||
|
||||
#define MTGCARD_NAME_SIZE 16
|
||||
|
||||
#define MTG_IMAGE_WIDTH 200
|
||||
#define MTG_IMAGE_HEIGHT 285
|
||||
@@ -28,7 +27,6 @@ protected:
|
||||
friend class MTGSetInfo;
|
||||
int mtgid;
|
||||
char rarity;
|
||||
char image_name[MTGCARD_NAME_SIZE];
|
||||
int init();
|
||||
|
||||
public:
|
||||
@@ -48,7 +46,7 @@ public:
|
||||
int getMTGId() const;
|
||||
int getId() const;
|
||||
char getRarity() const;
|
||||
char * getImageName();
|
||||
const string getImageName();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,6 @@ MTGCard::MTGCard(int set_id)
|
||||
|
||||
MTGCard::MTGCard(MTGCard * source)
|
||||
{
|
||||
strcpy(image_name, source->image_name);
|
||||
rarity = source->rarity;
|
||||
mtgid = source->mtgid;
|
||||
setId = source->setId;
|
||||
@@ -51,14 +50,6 @@ int MTGCard::init()
|
||||
void MTGCard::setMTGId(int id)
|
||||
{
|
||||
mtgid = id;
|
||||
if (id < 0)
|
||||
{
|
||||
sprintf(image_name, "%dt.jpg", -mtgid);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(image_name, "%d.jpg", mtgid);
|
||||
}
|
||||
}
|
||||
|
||||
int MTGCard::getMTGId() const
|
||||
@@ -79,9 +70,19 @@ void MTGCard::setRarity(char _rarity)
|
||||
rarity = _rarity;
|
||||
}
|
||||
|
||||
char * MTGCard::getImageName()
|
||||
const string MTGCard::getImageName()
|
||||
{
|
||||
return image_name;
|
||||
std::stringstream out;
|
||||
if (mtgid < 0)
|
||||
{
|
||||
//tokens that have negative id have an image name that is the absolute value of their id + letter "t"
|
||||
out << -mtgid << "t.jpg";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << mtgid << ".jpg";
|
||||
}
|
||||
return out.str();
|
||||
}
|
||||
|
||||
void MTGCard::setPrimitive(CardPrimitive * cp)
|
||||
|
||||
Reference in New Issue
Block a user