1515*/
1616
1717#include " FiveBitNumberDisplay.h"
18+ #include " ../../UI/imgui/Workspace.h"
1819
1920namespace LogiGates ::Core::LogicalElements {
2021
@@ -51,13 +52,13 @@ namespace LogiGates::Core::LogicalElements {
5152
5253 void FiveBitNumberDisplay::perform (std::set<int > performedIDs) {
5354 if (this ->checkRecursion (performedIDs)) return ;
54- Pin* inputs[5 ] = {pins[0 ], pins[1 ], pins[2 ], pins[3 ], pins[4 ]};
55+ Pin* inputs[5 ] = {pins[4 ], pins[3 ], pins[2 ], pins[1 ], pins[0 ]};
5556
5657 number = 0 ;
5758
5859 for (int i = 0 ; i < 5 ; i++) {
59- if (inputs[4 - i]->getConnectedWith () != -1 ) inputs[4 - i]->setState (Pin:: globalPinMap[inputs[4 - i]->getConnectedWith ()]->getState ());
60- number += inputs[4 - i]->getState () * pow (2 , i);
60+ if (inputs[i]->getConnectedWith () != -1 ) inputs[i]->setState (workspace-> globalPinMap [inputs[i]->getConnectedWith ()]->getState ());
61+ number += inputs[i]->getState () * pow (2 , 4 - i);
6162 }
6263
6364 performedIDs.emplace (this ->id );
@@ -75,9 +76,9 @@ namespace LogiGates::Core::LogicalElements {
7576 return ret;
7677 }
7778
78- void FiveBitNumberDisplay::restoreFromSaveInfo (SaveInfo info) {
79+ void FiveBitNumberDisplay::restoreFromSaveInfo (SaveInfo info, ImNodesEditorContext* editorCtx ) {
7980 this ->number = info.additionalInfo [0 ];
80- Base::restoreFromSaveInfo (info);
81+ Base::restoreFromSaveInfo (info, editorCtx );
8182 }
8283
8384}
0 commit comments