forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dialogue_chatbin.cpp
60 lines (53 loc) · 1.54 KB
/
dialogue_chatbin.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "dialogue_chatbin.h"
#include <algorithm>
#include <iterator>
#include "mission.h"
void dialogue_chatbin::add_new_mission( mission *miss )
{
if( miss == nullptr ) {
return;
}
missions.push_back( miss );
}
void dialogue_chatbin::check_missions()
{
// TODO: or simply fail them? Some missions might only need to be reported.
auto &ma = missions_assigned;
const auto last = std::remove_if( ma.begin(), ma.end(), []( class mission const * m ) {
return !m->is_assigned();
} );
std::copy( last, ma.end(), std::back_inserter( missions ) );
ma.erase( last, ma.end() );
}
void dialogue_chatbin::store_chosen_training( const skill_id &c_skill, const matype_id &c_style,
const spell_id &c_spell, const proficiency_id &c_proficiency )
{
if( c_skill == skill_id() && c_style == matype_id() && c_spell == spell_id() &&
c_proficiency == proficiency_id() ) {
return;
}
clear_training();
if( c_skill != skill_id() ) {
skill = c_skill;
} else if( c_style != matype_id() ) {
style = c_style;
} else if( c_spell != spell_id() ) {
dialogue_spell = c_spell;
} else if( c_proficiency != proficiency_id() ) {
proficiency = c_proficiency;
}
}
void dialogue_chatbin::clear_training()
{
style = matype_id();
skill = skill_id();
proficiency = proficiency_id();
dialogue_spell = spell_id();
}
void dialogue_chatbin::clear_all()
{
clear_training();
missions.clear();
missions_assigned.clear();
mission_selected = nullptr;
}