mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 19:47:46 -07:00
add an isEmpty method to printing info
no reason, I just find it easier to understand
This commit is contained in:
parent
2e10b2f5d5
commit
b9836074f3
3 changed files with 13 additions and 3 deletions
|
|
@ -62,7 +62,7 @@ void CardInfoTextWidget::setCard(const ExactCard &exactCard)
|
||||||
text += QString("<tr><td>%1</td><td width=\"5\"></td><td>%2</td></tr>")
|
text += QString("<tr><td>%1</td><td width=\"5\"></td><td>%2</td></tr>")
|
||||||
.arg(tr("Name:"), card->getName().toHtmlEscaped());
|
.arg(tr("Name:"), card->getName().toHtmlEscaped());
|
||||||
|
|
||||||
if (exactCard.getPrinting() != PrintingInfo()) {
|
if (!exactCard.getPrinting().isEmpty()) {
|
||||||
QString setShort = exactCard.getPrinting().getSet()->getShortName().toHtmlEscaped();
|
QString setShort = exactCard.getPrinting().getSet()->getShortName().toHtmlEscaped();
|
||||||
QString cardNum = exactCard.getPrinting().getProperty("num").toHtmlEscaped();
|
QString cardNum = exactCard.getPrinting().getProperty("num").toHtmlEscaped();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ ExactCard CardDatabaseQuerier::getRandomCard() const
|
||||||
ExactCard CardDatabaseQuerier::getCardFromSameSet(const QString &cardName, const PrintingInfo &otherPrinting) const
|
ExactCard CardDatabaseQuerier::getCardFromSameSet(const QString &cardName, const PrintingInfo &otherPrinting) const
|
||||||
{
|
{
|
||||||
// The source card does not have a printing defined, which means we can't get a card from the same set.
|
// The source card does not have a printing defined, which means we can't get a card from the same set.
|
||||||
if (otherPrinting == PrintingInfo()) {
|
if (otherPrinting.isEmpty()) {
|
||||||
return getCard({cardName});
|
return getCard({cardName});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,16 @@ public:
|
||||||
return this->set == other.set && this->properties == other.properties;
|
return this->set == other.set && this->properties == other.properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief check if the info is empty, as if default constructed.
|
||||||
|
*
|
||||||
|
* @return True if both set and properties are empty, otherwise false.
|
||||||
|
*/
|
||||||
|
bool isEmpty() const
|
||||||
|
{
|
||||||
|
return set == nullptr && properties.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CardSetPtr set; ///< The set this variation belongs to.
|
CardSetPtr set; ///< The set this variation belongs to.
|
||||||
QVariantHash properties; ///< Key-value store for variation-specific attributes.
|
QVariantHash properties; ///< Key-value store for variation-specific attributes.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue