-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEventCard.cpp
41 lines (33 loc) · 1.12 KB
/
EventCard.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "EventCard.hpp"
EventCard::EventCard(int redCircleNumber, int greenSquareNumber, int blueHexagonNumber, bool handshake, int goldNuggets, const QMap<int, Event *> &events, QObject *parent)
: QObject(parent), handshake(handshake), goldNuggets(goldNuggets), events(events)
{
this->shapeNumbers.insert(Event::RED_CIRCLE, redCircleNumber);
this->shapeNumbers.insert(Event::GREEN_SQUARE, greenSquareNumber);
this->shapeNumbers.insert(Event::BLUE_HEXAGON, blueHexagonNumber);
}
const Event *EventCard::getEvent(int era) const
{
return this->events.value(era, NULL);
}
QMap<Event::NumberShapes, int> EventCard::getShapeNumbers() const
{
return this->shapeNumbers;
}
int EventCard::getShapeNumberSum(const QMap<Event::NumberShapes, int> &shapeNumberAmounts) const
{
int result = 0;
foreach(Event::NumberShapes shape, shapeNumberAmounts.keys())
{
result += this->shapeNumbers.value(shape, 0)*shapeNumberAmounts.value(shape, 0);
}
return result;
}
bool EventCard::hasHandshake() const
{
return this->handshake;
}
int EventCard::getGoldNuggets() const
{
return this->goldNuggets;
}