mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-06 10:03:26 -08:00
* [Refactor] Move game logic into libcockatrice_game * [Refactor] Include card_state.h in player_actions.h * [Game] Inject settings providers into libcockatrice_game, drop Widgets * [Game] Follow base rename to createCardRequested after rebase * [Game] Drop unused CardItem forward declaration * [Game] Fix includes after moving game logic into libcockatrice_game --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
/**
|
|
* @file card_list.h
|
|
* @ingroup GameLogicCards
|
|
*/
|
|
//! \todo Document this file.
|
|
|
|
#ifndef CARDLIST_H
|
|
#define CARDLIST_H
|
|
|
|
#include <QList>
|
|
#include <QLoggingCategory>
|
|
#include <QString>
|
|
#include <functional>
|
|
|
|
inline Q_LOGGING_CATEGORY(CardListLog, "card_list");
|
|
|
|
class CardState;
|
|
|
|
class CardList : public QList<CardState *>
|
|
{
|
|
protected:
|
|
bool contentsKnown;
|
|
|
|
public:
|
|
enum SortOption
|
|
{
|
|
NoSort,
|
|
|
|
// Options that are used by groupBy
|
|
// Should partition all cards into a reasonable number of buckets
|
|
SortByMainType,
|
|
SortByManaValue,
|
|
SortByColorGrouping,
|
|
|
|
// Options that are used by sortBy
|
|
// We don't care about buckets; we want as many distinct values as possible.
|
|
SortByName,
|
|
SortByType,
|
|
SortByManaCost,
|
|
SortByColors,
|
|
SortByPt,
|
|
SortBySet,
|
|
SortByPrinting
|
|
};
|
|
explicit CardList(bool _contentsKnown);
|
|
CardState *findCard(const int cardId) const;
|
|
bool getContentsKnown() const
|
|
{
|
|
return contentsKnown;
|
|
}
|
|
|
|
void sortBy(const QList<SortOption> &options);
|
|
|
|
static std::function<QString(CardState *)> getExtractorFor(SortOption option);
|
|
};
|
|
|
|
#endif
|