mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
26 lines
664 B
C++
26 lines
664 B
C++
#include "tally.h"
|
|
|
|
#include "stats_tally.h"
|
|
#include "subtype_tally.h"
|
|
|
|
TallyType Tally::intToType(int value)
|
|
{
|
|
if (value < static_cast<int>(TallyType::None) || value > static_cast<int>(TallyType::MaxValue)) {
|
|
return TallyType::None;
|
|
}
|
|
|
|
return static_cast<TallyType>(value);
|
|
}
|
|
|
|
QList<TallyRow> Tally::compute(const QList<CardItem *> &cards, const TallyType type)
|
|
{
|
|
switch (type) {
|
|
case TallyType::None:
|
|
return {};
|
|
case TallyType::Subtypes:
|
|
return SubtypeTally::countSubtypes(cards);
|
|
case TallyType::TotalPower:
|
|
return StatsTally::computeTotalPower(cards);
|
|
}
|
|
return {};
|
|
}
|