File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 1- // Copyright 2023-2023 the openage authors. See copying.md for legal info.
1+ // Copyright 2023-2024 the openage authors. See copying.md for legal info.
22
33#pragma once
44
Original file line number Diff line number Diff line change 1616#include " gamestate/activity/types.h"
1717#include " gamestate/activity/xor_event_gate.h"
1818#include " gamestate/activity/xor_gate.h"
19+ #include " gamestate/activity/xor_switch_gate.h"
1920#include " gamestate/component/internal/activity.h"
2021#include " gamestate/component/types.h"
2122#include " gamestate/game_entity.h"
@@ -112,6 +113,15 @@ void Activity::advance(const time::time_t &start_time,
112113 event_wait_time = 0 ;
113114 stop = true ;
114115 } break ;
116+ case activity::node_t ::XOR_SWITCH_GATE: {
117+ auto node = std::dynamic_pointer_cast<activity::XorSwitchGate>(current_node);
118+ auto next_id = node->get_default ()->get_id ();
119+ auto key = node->get_lookup_func ()(start_time, entity);
120+ if (node->get_lookup_dict ().contains (key)) {
121+ next_id = node->get_lookup_dict ().at (key)->get_id ();
122+ }
123+ current_node = node->next (next_id);
124+ } break ;
115125 default :
116126 throw Error{ERR << " Unhandled node type for node " << current_node->str ()};
117127 }
You can’t perform that action at this time.
0 commit comments