Symphony Of Empires
event.cpp
Go to the documentation of this file.
1
// Symphony of Empires
2
// Copyright (C) 2021, Symphony of Empires contributors
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program. If not, see <https://www.gnu.org/licenses/>.
16
//
17
// ----------------------------------------------------------------------------
18
// Name:
19
// event.cpp
20
//
21
// Abstract:
22
// Does some important stuff.
23
// ----------------------------------------------------------------------------
24
25
#include <algorithm>
26
#include <cassert>
27
28
#include "
event.hpp
"
29
#include "
world.hpp
"
30
#include "
nation.hpp
"
31
32
//
33
// Event
34
//
35
void
Event::take_decision
(
Nation
& sender,
Decision
& dec) {
36
g_world
.
taken_decisions
.emplace_back(dec, sender);
// Tell the world that we took a decision
37
std::erase_if(sender.
inbox
, [
this
](
const
auto
& e) {
// Remove from inbox too
38
return this->ref_name == e.ref_name;
39
});
40
}
Nation
Definition:
nation.hpp:49
Nation::inbox
std::deque< Event > inbox
Definition:
nation.hpp:150
World::taken_decisions
std::vector< std::pair< Decision, NationId > > taken_decisions
Definition:
world.hpp:228
event.hpp
nation.hpp
Decision
Definition:
event.hpp:31
Event::take_decision
void take_decision(Nation &sender, Decision &dec)
Definition:
event.cpp:35
g_world
World g_world
Definition:
world.cpp:59
world.hpp
game
src
event.cpp
Generated by
1.9.1