From 616fb965878997e4225afa651c5a4206a504fb61 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Thu, 7 Nov 2019 10:15:29 -0800 Subject: Design for new version -- will still have to do conversions. --- Source/Panel.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'Source/Panel.cpp') diff --git a/Source/Panel.cpp b/Source/Panel.cpp index c0fb7ec..ea65142 100644 --- a/Source/Panel.cpp +++ b/Source/Panel.cpp @@ -12,8 +12,7 @@ int find(const std::vector &data, T search, size_t startIndex = 0) { return -1; } -Panel::Panel(int id) { - _memory = std::make_shared("witness64_d3d11.exe"); +Panel::Panel(const std::shared_ptr& memory, int id) : _memory(memory) { _width = 2 * _memory->ReadPanelData(id, GRID_SIZE_X, 1)[0] - 1; _height = 2 * _memory->ReadPanelData(id, GRID_SIZE_Y, 1)[0] - 1; _grid.resize(_width); @@ -45,7 +44,7 @@ nlohmann::json Panel::Serialize() { for (int x=0; x<_width; x++) { for (int y=0; y<_height; y++) { if (x%2 == 1 && y%2 == 1) { - puzzle["grid"][x][y] = Decoration::to_json(_grid[x][y]); + puzzle["grid"][x][y] = Decoration_to_json(_grid[x][y]); } else { if (_grid[x][y] & IntersectionFlags::HAS_DOT) { puzzle["dots"].emplace_back(nlohmann::json({{"x", x}, {"y", y}})); @@ -69,17 +68,6 @@ nlohmann::json Panel::Serialize() { return puzzle; } -void Panel::Random() { -/* - for (auto& row : _decorations) { - for (auto& cell : row) { - cell.SetShape(cell.GetShape() & 0xFFFFFFF0); - cell.SetShape(cell.GetShape() | Random::RandInt(1, 10)); - } - } -*/ -} - void Panel::ReadDecorations(int id) { int numDecorations = _memory->ReadPanelData(id, NUM_DECORATIONS, 1)[0]; std::vector decorations = _memory->ReadArray(id, DECORATIONS, numDecorations); -- cgit 1.4.1