Compare commits
3 commits
4baca47f72
...
e786cf2d7a
Author | SHA1 | Date | |
---|---|---|---|
e786cf2d7a | |||
1cd91e1aaa | |||
be4d1029c5 |
2 changed files with 51 additions and 2 deletions
|
@ -381,9 +381,10 @@ void ResearchTree::generateArchTree() {
|
|||
void ResearchTree::readEngineUnlocks(Containers::ArrayView<Int> engines, Containers::ArrayView<Int> gears) {
|
||||
if(engines == nullptr || engines.size() == 0) {
|
||||
Utility::Error{} << "Engines can't be empty";
|
||||
return;
|
||||
}
|
||||
|
||||
for(Int& engine : engines) {
|
||||
for(Int engine : engines) {
|
||||
if(_engineNodes.find(engine) != _engineNodes.end()) {
|
||||
_engineNodes.at(engine).setState(Node::State::Unlocked);
|
||||
}
|
||||
|
@ -393,13 +394,59 @@ void ResearchTree::readEngineUnlocks(Containers::ArrayView<Int> engines, Contain
|
|||
return;
|
||||
}
|
||||
|
||||
for(Int& gear : gears) {
|
||||
for(Int gear : gears) {
|
||||
if(_engineNodes.find(gear) != _engineNodes.end()) {
|
||||
_engineNodes.at(gear).setState(Node::State::Unlocked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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& {
|
||||
return _engineNodes.at(VerseEngine);
|
||||
}
|
||||
|
|
|
@ -99,6 +99,8 @@ class ResearchTree {
|
|||
void generateArchTree();
|
||||
|
||||
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 getOSRootNode() -> Node&;
|
||||
|
|
Loading…
Reference in a new issue