WIP: Add a research tree view #1
2 changed files with 48 additions and 0 deletions
|
@ -401,6 +401,52 @@ void ResearchTree::readEngineUnlocks(Containers::ArrayView<Int> engines, Contain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResearchTree::readOSUnlocks(Containers::ArrayView<Int> os, Containers::ArrayView<Int> modules) {
|
||||||
|
if(os == nullptr || os.size() == 0) {
|
||||||
|
Utility::Error{} << "OSes can't be empty";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Int os_id : os) {
|
||||||
|
if(_osNodes.find(os_id) != _osNodes.end()) {
|
||||||
|
_osNodes.at(os_id).setState(Node::State::Unlocked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(modules == nullptr || modules.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Int module : modules) {
|
||||||
|
if(_osNodes.find(module) != _osNodes.end()) {
|
||||||
|
_osNodes.at(module).setState(Node::State::Unlocked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResearchTree::readArchUnlocks(Containers::ArrayView<Int> archs, Containers::ArrayView<Int> techs) {
|
||||||
|
if(archs == nullptr || archs.size() == 0) {
|
||||||
|
Utility::Error{} << "Archs can't be empty";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Int arch : archs) {
|
||||||
|
if(_archNodes.find(arch) != _archNodes.end()) {
|
||||||
|
_archNodes.at(arch).setState(Node::State::Unlocked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(techs == nullptr || techs.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Int tech : techs) {
|
||||||
|
if(_archNodes.find(tech) != _archNodes.end()) {
|
||||||
|
_archNodes.at(tech).setState(Node::State::Unlocked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto ResearchTree::getEngineRootNode() -> Node& {
|
auto ResearchTree::getEngineRootNode() -> Node& {
|
||||||
return _engineNodes.at(VerseEngine);
|
return _engineNodes.at(VerseEngine);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,8 @@ class ResearchTree {
|
||||||
void generateArchTree();
|
void generateArchTree();
|
||||||
|
|
||||||
void readEngineUnlocks(Containers::ArrayView<Int> engines, Containers::ArrayView<Int> gears = nullptr);
|
void readEngineUnlocks(Containers::ArrayView<Int> engines, Containers::ArrayView<Int> gears = nullptr);
|
||||||
|
void readOSUnlocks(Containers::ArrayView<Int> os, Containers::ArrayView<Int> modules = nullptr);
|
||||||
|
void readArchUnlocks(Containers::ArrayView<Int> archs, Containers::ArrayView<Int> techs = nullptr);
|
||||||
|
|
||||||
auto getEngineRootNode() -> Node&;
|
auto getEngineRootNode() -> Node&;
|
||||||
auto getOSRootNode() -> Node&;
|
auto getOSRootNode() -> Node&;
|
||||||
|
|
Loading…
Reference in a new issue