-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventsManipulator.cpp
More file actions
39 lines (29 loc) · 917 Bytes
/
Copy pathEventsManipulator.cpp
File metadata and controls
39 lines (29 loc) · 917 Bytes
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
#include <Messages/All.h>
#include "WorldLogic.h"
#include "EventsManipulator.h"
EventsManipulator::EventsManipulator(WorldLogic& world)
: _world{ world } {
}
void EventsManipulator::SelectNextEvent() {
auto evt = _world.TakeNextEvent();
_world.SetGlobalEvent(evt);
}
void EventsManipulator::Shuffle() {
_world.EventsDeck().Reset(true);
_world.EventsDeck().ForEach([this](int i, GlobalEventType p) {
EventAddedToDeckMessage msg{ i, p };
_world.Notify(msg);
});
EventsShuffledMessage msg{};
_world.Notify(msg);
}
ConstEventsManipulator::ConstEventsManipulator(const WorldLogic& world)
:_world{ world } {
}
const EventTemplate& ConstEventsManipulator::Current() const {
auto evt = _world.EventsDeck().Current();
return GetEventTemplate(evt);
}
const EventTemplate& EventsManipulator::Current() const {
return ConstEventsManipulator(_world).Current();
}