about summary refs log tree commit diff stats
path: root/Source/RandomizerCore.cpp
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2018-11-01 20:56:56 -0700
committerjbzdarkid <jbzdarkid@gmail.com>2018-11-01 20:56:56 -0700
commit5de975b03c7200cc66188a4b1a76e1213524975d (patch)
treee3ed982a0dd4fee4db402532aeda2e6bf5e66344 /Source/RandomizerCore.cpp
parent3557f0ba80942397a9d963208695b4fa80290cb0 (diff)
downloadwitness-tutorializer-5de975b03c7200cc66188a4b1a76e1213524975d.tar.gz
witness-tutorializer-5de975b03c7200cc66188a4b1a76e1213524975d.tar.bz2
witness-tutorializer-5de975b03c7200cc66188a4b1a76e1213524975d.zip
pain and suffering, but I can read/write decorations & dots.
Diffstat (limited to 'Source/RandomizerCore.cpp')
-rw-r--r--Source/RandomizerCore.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/RandomizerCore.cpp b/Source/RandomizerCore.cpp index f14a76f..d4aadef 100644 --- a/Source/RandomizerCore.cpp +++ b/Source/RandomizerCore.cpp
@@ -101,10 +101,10 @@ void RandomizerCore::SwapPanels(int panel1, int panel2, int flags) {
101 } 101 }
102 102
103 for (auto const& [offset, size] : offsets) { 103 for (auto const& [offset, size] : offsets) {
104 std::vector<byte> panel1data = ReadPanelData<byte>(panel1, offset, size); 104 std::vector<byte> panel1data = _memory.ReadPanelData<byte>(panel1, offset, size);
105 std::vector<byte> panel2data = ReadPanelData<byte>(panel2, offset, size); 105 std::vector<byte> panel2data = _memory.ReadPanelData<byte>(panel2, offset, size);
106 WritePanelData<byte>(panel2, offset, panel1data); 106 _memory.WritePanelData<byte>(panel2, offset, panel1data);
107 WritePanelData<byte>(panel1, offset, panel2data); 107 _memory.WritePanelData<byte>(panel1, offset, panel2data);
108 } 108 }
109} 109}
110 110
@@ -114,7 +114,7 @@ void RandomizerCore::ReassignTargets(const std::vector<int>& panels, const std::
114 // The first panel may not have a wire to power it, so we use the panel ID itself. 114 // The first panel may not have a wire to power it, so we use the panel ID itself.
115 targets = {panels[0] + 1}; 115 targets = {panels[0] + 1};
116 for (const int panel : panels) { 116 for (const int panel : panels) {
117 int target = ReadPanelData<int>(panel, TARGET, 1)[0]; 117 int target = _memory.ReadPanelData<int>(panel, TARGET, 1)[0];
118 targets.push_back(target); 118 targets.push_back(target);
119 } 119 }
120 } 120 }
@@ -122,18 +122,18 @@ void RandomizerCore::ReassignTargets(const std::vector<int>& panels, const std::
122 for (size_t i=0; i<order.size() - 1; i++) { 122 for (size_t i=0; i<order.size() - 1; i++) {
123 // Set the target of order[i] to order[i+1], using the "real" target as determined above. 123 // Set the target of order[i] to order[i+1], using the "real" target as determined above.
124 const int panelTarget = targets[order[i+1]]; 124 const int panelTarget = targets[order[i+1]];
125 WritePanelData<int>(panels[order[i]], TARGET, {panelTarget}); 125 _memory.WritePanelData<int>(panels[order[i]], TARGET, {panelTarget});
126 } 126 }
127} 127}
128 128
129void RandomizerCore::ReassignNames(const std::vector<int>& panels, const std::vector<int>& order) { 129void RandomizerCore::ReassignNames(const std::vector<int>& panels, const std::vector<int>& order) {
130 std::vector<int64_t> names; 130 std::vector<int64_t> names;
131 for (const int panel : panels) { 131 for (const int panel : panels) {
132 names.push_back(ReadPanelData<int64_t>(panel, AUDIO_LOG_NAME, 1)[0]); 132 names.push_back(_memory.ReadPanelData<int64_t>(panel, AUDIO_LOG_NAME, 1)[0]);
133 } 133 }
134 134
135 for (int i=0; i<panels.size(); i++) { 135 for (int i=0; i<panels.size(); i++) {
136 WritePanelData<int64_t>(panels[i], AUDIO_LOG_NAME, {names[order[i]]}); 136 _memory.WritePanelData<int64_t>(panels[i], AUDIO_LOG_NAME, {names[order[i]]});
137 } 137 }
138} 138}
139 139