forked from miki151/keeperrl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.cpp
70 lines (51 loc) · 1.93 KB
/
view.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
61
62
63
64
65
66
67
68
69
70
/* Copyright (C) 2013-2014 Michal Brzozowski (rusolis@poczta.fm)
This file is part of KeeperRL.
KeeperRL is free software; you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
KeeperRL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see http://www.gnu.org/licenses/ . */
#include "stdafx.h"
#include "view.h"
#include "creature.h"
#include "collective.h"
View::ListElem::ListElem(const string& t, ElemMod m, Optional<UserInput::Type> a) : text(t), mod(m), action(a) {
}
View::ListElem::ListElem(const char* s, ElemMod m, Optional<UserInput::Type> a) : text(s), mod(m), action(a) {
}
const string& View::ListElem::getText() const {
return text;
}
View::ElemMod View::ListElem::getMod() const {
return mod;
}
Optional<UserInput::Type> View::ListElem::getAction() const {
return action;
}
vector<View::ListElem> View::getListElem(const vector<string>& v) {
function<ListElem(const string&)> fun = [](const string& s) -> ListElem { return ListElem(s); };
return transform2<ListElem>(v, fun);
}
void View::setJukebox(Jukebox* j) {
jukebox = j;
}
Jukebox* View::getJukebox() {
return NOTNULL(jukebox);
}
View::View() {
}
View::~View() {
}
GameInfo::CreatureInfo::CreatureInfo(const Collective* col, const Creature* c)
: viewObject(c->getViewObject()),
uniqueId(c->getUniqueId()),
name(c->getName()),
speciesName(c->getSpeciesName()),
expLevel(c->getExpLevel()),
morale(c->getMorale()),
salary(col ? col->getSalary(c) : 0),
credit(col ? 0 : 0) {
}