mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Replace CardInfo* and Carset* with smart pointers (#3053)
* Replace CardInfo* and Carset* with smart pointers * fixes to help memory & c++11 stuff
This commit is contained in:
parent
3e418ba3c6
commit
517420cccb
37 changed files with 409 additions and 342 deletions
|
|
@ -120,7 +120,7 @@ struct FormatDeckListForExport
|
|||
void operator()(const InnerDecklistNode *node, const DecklistCardNode *card) const
|
||||
{
|
||||
// Get the card name
|
||||
CardInfo *dbCard = db->getCard(card->getName());
|
||||
CardInfoPtr dbCard = db->getCard(card->getName());
|
||||
if (!dbCard || dbCard->getIsToken()) {
|
||||
// If it's a token, we don't care about the card.
|
||||
return;
|
||||
|
|
@ -223,7 +223,7 @@ void DeckLoader::saveToStream_DeckZone(QTextStream &out, const InnerDecklistNode
|
|||
for (int j = 0; j < zoneNode->size(); j++) {
|
||||
auto *card = dynamic_cast<DecklistCardNode *>(zoneNode->at(j));
|
||||
|
||||
CardInfo *info = db->getCard(card->getName());
|
||||
CardInfoPtr info = db->getCard(card->getName());
|
||||
QString cardType = info ? info->getMainCardType() : "unknown";
|
||||
|
||||
cardsByType.insert(cardType, card);
|
||||
|
|
@ -276,7 +276,7 @@ void DeckLoader::saveToStream_DeckZoneCards(QTextStream &out,
|
|||
|
||||
QString DeckLoader::getCardZoneFromName(QString cardName, QString currentZoneName)
|
||||
{
|
||||
CardInfo *card = db->getCard(cardName);
|
||||
CardInfoPtr card = db->getCard(cardName);
|
||||
|
||||
if (card && card->getIsToken()) {
|
||||
return DECK_ZONE_TOKENS;
|
||||
|
|
@ -288,7 +288,7 @@ QString DeckLoader::getCardZoneFromName(QString cardName, QString currentZoneNam
|
|||
QString DeckLoader::getCompleteCardName(const QString cardName) const
|
||||
{
|
||||
if (db) {
|
||||
CardInfo *temp = db->getCardBySimpleName(cardName);
|
||||
CardInfoPtr temp = db->getCardBySimpleName(cardName);
|
||||
if (temp) {
|
||||
return temp->getName();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue