diff options
Diffstat (limited to 'Source/PuzzleSerializer.cpp')
| -rw-r--r-- | Source/PuzzleSerializer.cpp | 20 | 
1 files changed, 14 insertions, 6 deletions
| diff --git a/Source/PuzzleSerializer.cpp b/Source/PuzzleSerializer.cpp index a131376..fb4166b 100644 --- a/Source/PuzzleSerializer.cpp +++ b/Source/PuzzleSerializer.cpp | |||
| @@ -485,7 +485,6 @@ void PuzzleSerializer::WriteSymmetry(const Puzzle& p, int id) { | |||
| 485 | reflectionData[location] = symLocation; | 485 | reflectionData[location] = symLocation; | 
| 486 | reflectionData[symLocation] = location; | 486 | reflectionData[symLocation] = location; | 
| 487 | if (p.grid[x][y].end != Cell::Dir::NONE) { | 487 | if (p.grid[x][y].end != Cell::Dir::NONE) { | 
| 488 | // Rely on symmetry to set the other pair | ||
| 489 | location = extra_xy_to_loc(p, x, y); | 488 | location = extra_xy_to_loc(p, x, y); | 
| 490 | Pos sym = p.GetSymmetricalPos(x, y); | 489 | Pos sym = p.GetSymmetricalPos(x, y); | 
| 491 | symLocation = extra_xy_to_loc(p, sym.x, sym.y); | 490 | symLocation = extra_xy_to_loc(p, sym.x, sym.y); | 
| @@ -503,11 +502,20 @@ void PuzzleSerializer::WriteSymmetry(const Puzzle& p, int id) { | |||
| 503 | int location = extra_xy_to_loc(p, x, y); | 502 | int location = extra_xy_to_loc(p, x, y); | 
| 504 | int symLocation = extra_xy_to_loc(p, sym.x, sym.y); | 503 | int symLocation = extra_xy_to_loc(p, sym.x, sym.y); | 
| 505 | // Each gap results in two intersections, @Assume they're written consecutively | 504 | // Each gap results in two intersections, @Assume they're written consecutively | 
| 506 | // Rely on symmetry to set the other pairs | 505 | |
| 507 | reflectionData[location] = symLocation; | 506 | if ((x%2 != 0 && p.symmetry & Puzzle::Symmetry::X) || | 
| 508 | reflectionData[location-1] = symLocation-1; | 507 | (y%2 != 0 && p.symmetry & Puzzle::Symmetry::Y)) { | 
| 509 | reflectionData[symLocation] = location; | 508 | // Write data inverted, because it's being reflected | 
| 510 | reflectionData[symLocation-1] = location-1; | 509 | reflectionData[location] = symLocation-1; | 
| 510 | reflectionData[location-1] = symLocation; | ||
| 511 | reflectionData[symLocation] = location-1; | ||
| 512 | reflectionData[symLocation-1] = location; | ||
| 513 | } else { // Write data normally | ||
| 514 | reflectionData[location] = symLocation; | ||
| 515 | reflectionData[location-1] = symLocation-1; | ||
| 516 | reflectionData[symLocation] = location; | ||
| 517 | reflectionData[symLocation-1] = location-1; | ||
| 518 | } | ||
| 511 | } | 519 | } | 
| 512 | } | 520 | } | 
| 513 | 521 | ||
