mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 00:55:09 -07:00
[DeckListModel] Refactor: general code cleanup (#6460)
* change one usage * move method * move format check code * make group criteria method static * move method * make method private * more comments
This commit is contained in:
parent
968be8a06f
commit
d722b2569c
5 changed files with 66 additions and 59 deletions
|
|
@ -75,6 +75,16 @@ QString CardInfo::getCorrectedName() const
|
|||
return result.remove(rmrx).replace(spacerx, space);
|
||||
}
|
||||
|
||||
bool CardInfo::isLegalInFormat(const QString &format) const
|
||||
{
|
||||
if (format.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
QString formatLegality = getProperty("format-" + format);
|
||||
return formatLegality == "legal" || formatLegality == "restricted";
|
||||
}
|
||||
|
||||
void CardInfo::addToSet(const CardSetPtr &_set, const PrintingInfo _info)
|
||||
{
|
||||
if (!_set->contains(smartThis)) {
|
||||
|
|
|
|||
|
|
@ -291,6 +291,15 @@ public:
|
|||
*/
|
||||
[[nodiscard]] QString getCorrectedName() 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
|
||||
* "legal" or "restricted".
|
||||
* @param format The format's name. If empty, will always return true.
|
||||
* @return Whether the card is legal in the given format.
|
||||
*/
|
||||
[[nodiscard]] bool isLegalInFormat(const QString &format) const;
|
||||
|
||||
/**
|
||||
* @brief Adds a printing to a specific set.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue