We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a576079 commit c5d2856Copy full SHA for c5d2856
1 file changed
src/specialComponents/Input.cpp
@@ -21,18 +21,23 @@ nts::InputComponent::~InputComponent()
21
22
void nts::InputComponent::simulate(std::size_t tick)
23
{
24
- (void)tick;
25
- if (_pins[0].lock() == nullptr) {
+ if (_lastTick == tick)
+ return;
26
+ _lastTick = tick;
27
+
28
+ if (_pins[0].lock() == nullptr)
29
this->setState(nts::UNDEFINED);
- }
30
else {
- this->setState(_pins[0].lock()->compute(tick));
31
+ auto linkedComponent = _pins[0].lock();
32
+ linkedComponent->simulate(tick);
33
+ this->setState(linkedComponent->getState());
34
}
35
36
37
nts::Tristate nts::InputComponent::compute(std::size_t tick)
38
- this->simulate(tick);
39
+ if (_lastTick != tick)
40
+ this->simulate(tick);
41
return this->getState();
42
43
0 commit comments