diff --git a/source/code/puzzle_editor/PuzzleEditorState.cpp b/source/code/puzzle_editor/PuzzleEditorState.cpp index 42b8200..db6ff40 100644 --- a/source/code/puzzle_editor/PuzzleEditorState.cpp +++ b/source/code/puzzle_editor/PuzzleEditorState.cpp @@ -291,6 +291,14 @@ void PuzzleEditorState::Draw(SDL_Renderer* target) { } ImGui::Separator(); ImGui::LabelText("moves allowed", "%i", PuzzleNumberOfMovesAllowed(this->selected_puzzle)); + if (ImGui::Button("+1 move")) { + PuzzleNumberOfMovesAllowedSet(this->selected_puzzle, PuzzleNumberOfMovesAllowed(this->selected_puzzle)+1); + SavePuzzleStages(); + } + if (ImGui::Button("-1 move")) { + PuzzleNumberOfMovesAllowedSet(this->selected_puzzle, PuzzleNumberOfMovesAllowed(this->selected_puzzle)-1); + SavePuzzleStages(); + } ImGui::Separator(); if (read_only) { ImGui::LabelText("Read Only", ""); diff --git a/source/code/puzzlehandler.cpp b/source/code/puzzlehandler.cpp index afabe66..9e8abeb 100644 --- a/source/code/puzzlehandler.cpp +++ b/source/code/puzzlehandler.cpp @@ -49,6 +49,13 @@ int PuzzleNumberOfMovesAllowed(size_t level) { return nrOfMovesAllowed.at(level); } +void PuzzleNumberOfMovesAllowedSet(size_t level, int numbler_of_moves) { + if (level >= nrOfMovesAllowed.size()) { + return; + } + nrOfMovesAllowed[level] = numbler_of_moves; +} + int PuzzleGetBrick(size_t level, int x, int y) { if (level >= maxNrOfPuzzleStages || x >= 6 || y >= 12 || x < 0 || y < 0) { return -1; diff --git a/source/code/puzzlehandler.hpp b/source/code/puzzlehandler.hpp index 707b7f4..0f46cea 100644 --- a/source/code/puzzlehandler.hpp +++ b/source/code/puzzlehandler.hpp @@ -28,6 +28,7 @@ http://www.blockattack.net #include int PuzzleNumberOfMovesAllowed(size_t level); +void PuzzleNumberOfMovesAllowedSet(size_t level, int numbler_of_moves); int PuzzleGetBrick(size_t level, int x, int y); void PuzzleSetBrick(size_t level, int x, int y, int brick); // used only for editor bool PuzzleIsCleared(size_t level);