Skip to content

Commit

Permalink
gamestate: Fix reading from nyan activity condition API object.
Browse files Browse the repository at this point in the history
  • Loading branch information
heinezen committed Dec 24, 2023
1 parent 988583c commit 6a46710
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libopenage/gamestate/api/activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@ std::vector<nyan::Object> APIActivityNode::get_next(const nyan::Object &node) {
}
// 1+ next nodes
case activity::node_t::XOR_GATE: {
auto next = node.get<nyan::OrderedSet>("Node.next");
auto conditions = node.get<nyan::OrderedSet>("Node.next");
std::shared_ptr<nyan::View> db_view = node.get_view();

std::vector<nyan::Object> next_nodes;
for (auto &next_node : next->get()) {
auto next_node_value = std::dynamic_pointer_cast<nyan::ObjectValue>(next_node.get_ptr());
for (auto &condition : conditions->get()) {
auto condition_fqon = std::dynamic_pointer_cast<nyan::ObjectValue>(condition.get_ptr());
auto condition_obj = db_view->get_object(condition_fqon->get_name());

auto next_node_value = condition_obj.get<nyan::ObjectValue>("Condition.next");
next_nodes.push_back(db_view->get_object(next_node_value->get_name()));
}

Expand Down

0 comments on commit 6a46710

Please sign in to comment.