mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-05 21:13:55 -07:00
[CardInfo] Refactor: add getLegalityProp method (#6536)
This commit is contained in:
parent
39ddaa0c35
commit
2e1a0bec93
5 changed files with 20 additions and 9 deletions
|
|
@ -75,13 +75,18 @@ QString CardInfo::getCorrectedName() const
|
|||
return result.remove(rmrx).replace(spacerx, space);
|
||||
}
|
||||
|
||||
QString CardInfo::getLegalityProp(const QString &format) const
|
||||
{
|
||||
return getProperty("format-" + format);
|
||||
}
|
||||
|
||||
bool CardInfo::isLegalInFormat(const QString &format) const
|
||||
{
|
||||
if (format.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
QString formatLegality = getProperty("format-" + format);
|
||||
QString formatLegality = getLegalityProp(format);
|
||||
return formatLegality == "legal" || formatLegality == "restricted";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -291,6 +291,14 @@ public:
|
|||
*/
|
||||
[[nodiscard]] QString getCorrectedName() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the card's legality value for the given format.
|
||||
* The legality prop for a format is stored in the property map under the key "format-<name>"
|
||||
* @param format The format's name.
|
||||
* @return The card's legality value for the format. Empty if not found.
|
||||
*/
|
||||
[[nodiscard]] QString getLegalityProp(const QString &format) const;
|
||||
|
||||
/**
|
||||
* @brief Checks if the card is legal in the given format.
|
||||
* A card is considered legal in a format if its properties map contains an entry for "format-<name>", with value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue