git repos / blockattack-game

commit f390a0aa

Poul Sander · 2025-10-05 12:24
f390a0aa279226cea6b971377984681bc07d0abd patch · browse files
parent 4ebb3d36162e77af7d5e2169895b3eecde43a5d1

Cleaned up the save puzzle calls to make them aligned with the savestate calls

Changed files

M source/code/puzzle_editor/PuzzleEditorState.cpp before
diff --git a/source/code/puzzle_editor/PuzzleEditorState.cpp b/source/code/puzzle_editor/PuzzleEditorState.cpp index 5ae18cf..a6ba1f0 100644 --- a/source/code/puzzle_editor/PuzzleEditorState.cpp +++ b/source/code/puzzle_editor/PuzzleEditorState.cpp
@@ -291,28 +291,23 @@ void PuzzleEditorState::BrickClicked(int x, int y) {
if (selected_action >= 0 && selected_action < 7) {
PuzzleSetBrick(this->selected_puzzle, x, y, this->selected_action);
- SavePuzzleStages();
}
if (selected_action == selection_clear) {
PuzzleSetBrick(this->selected_puzzle, x, y, -1);
- SavePuzzleStages();
}
if (selected_action == selection_move_up) {
BricksMoveUp(this->selected_puzzle, x, y);
- SavePuzzleStages();
}
if (selected_action == selection_move_down) {
BricksMoveDown(this->selected_puzzle, x, y);
- SavePuzzleStages();
}
if (selected_action == selection_move_left) {
BricksMoveColumnLeft(this->selected_puzzle, x);
- SavePuzzleStages();
}
if (selected_action == selection_move_right) {
BricksMoveColumnRight(this->selected_puzzle, x);
- SavePuzzleStages();
}
+ SavePuzzleStages();
}
@@ -447,16 +442,16 @@ void PuzzleEditorState::Draw(SDL_Renderer* target) {
if (ImGui::Button("+1 move")) {
if (!read_only) {
SaveCurrentState();
+ PuzzleNumberOfMovesAllowedSet(this->selected_puzzle, PuzzleNumberOfMovesAllowed(this->selected_puzzle)+1);
+ SavePuzzleStages();
}
- PuzzleNumberOfMovesAllowedSet(this->selected_puzzle, PuzzleNumberOfMovesAllowed(this->selected_puzzle)+1);
- SavePuzzleStages();
}
if (ImGui::Button("-1 move")) {
if (!read_only) {
SaveCurrentState();
+ PuzzleNumberOfMovesAllowedSet(this->selected_puzzle, PuzzleNumberOfMovesAllowed(this->selected_puzzle)-1);
+ SavePuzzleStages();
}
- PuzzleNumberOfMovesAllowedSet(this->selected_puzzle, PuzzleNumberOfMovesAllowed(this->selected_puzzle)-1);
- SavePuzzleStages();
}
ImGui::Separator();
if (read_only) {