forked from Whales/Cataclysm2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathskill.cpp
More file actions
82 lines (72 loc) · 2.14 KB
/
Copy pathskill.cpp
File metadata and controls
82 lines (72 loc) · 2.14 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "skill.h"
#include "stringfunc.h"
#include <string>
Skill_set::Skill_set()
{
for (int i = 0; i < SKILL_MAX; i++) {
level[i] = 0;
}
}
Skill_set::~Skill_set()
{
}
Skill_set& Skill_set::operator=(const Skill_set& rhs)
{
if (this == &rhs) {
return (*this);
}
for (int i = 0; i < SKILL_MAX; i++) {
level[i] = rhs.get_level( Skill_type(i) );
}
return (*this);
}
int Skill_set::get_level(Skill_type type) const
{
return level[type];
}
void Skill_set::set_level(Skill_type type, int lev)
{
level[type] = lev;
}
Skill_type lookup_skill_type(std::string name)
{
name = no_caps( trim( name ) );
for (int i = 0; i < SKILL_MAX; i++) {
Skill_type ret = Skill_type(i);
if (no_caps( skill_type_name(ret) ) == name) {
return ret;
}
}
return SKILL_NULL;
}
std::string skill_type_name(Skill_type type)
{
switch (type) {
case SKILL_NULL: return "NULL";
case SKILL_MELEE: return "melee";
case SKILL_UNARMED: return "unarmed";
case SKILL_BASH: return "bashing_weapons";
case SKILL_CUT: return "cutting_weapons";
case SKILL_PIERCE: return "piercing_weapons";
case SKILL_DODGE: return "dodge";
case SKILL_THROWING: return "throwing";
case SKILL_LAUNCHERS: return "launchers";
case SKILL_HANDGUNS: return "handguns";
case SKILL_SHOTGUNS: return "shotguns";
case SKILL_SMGS: return "SMGs";
case SKILL_RIFLES: return "rifles";
case SKILL_MECHANICS: return "mechanics";
case SKILL_ELECTRONICS: return "electronics";
case SKILL_CONSTRUCTION: return "construction";
case SKILL_SPEECH: return "speech";
case SKILL_BARTER: return "barter";
case SKILL_COOKING: return "cooking";
case SKILL_FIRST_AID: return "first_aid";
case SKILL_BOTANY: return "botany";
case SKILL_SURVIVAL: return "survival";
case SKILL_DRIVING: return "driving";
case SKILL_MAX: return "ERROR - SKILL_MAX";
default: return "ERROR - Unnamed skill";
}
return "ERROR - Escaped skill_type_name() switch!";
}