git repos / blockattack-game

commit 9d84cac6

Poul Sander · 2025-10-07 18:43
9d84cac649366266dfa740249ad19f50e14344ed patch · browse files
parent f390a0aa279226cea6b971377984681bc07d0abd

Stop using double negative. empty is good to test for emptiness but we are not testing for emptynes. We are testing for the opposite.

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 a6ba1f0..cf85ebd 100644 --- a/source/code/puzzle_editor/PuzzleEditorState.cpp +++ b/source/code/puzzle_editor/PuzzleEditorState.cpp
@@ -168,7 +168,7 @@ void PuzzleEditorState::SaveCurrentState() {
undo_stack.pop_back();
}
undo_stack = std::vector<PuzzleState>();
- while (!temp.empty()) {
+ while (temp.size()) {
undo_stack.push_back(temp.back());
temp.pop_back();
}
@@ -189,7 +189,7 @@ void PuzzleEditorState::SaveCurrentState() {
}
undo_stack.push_back(current_state);
- while (!redo_stack.empty()) {
+ while (redo_stack.size()) {
redo_stack.pop_back();
}
}
@@ -269,11 +269,11 @@ void PuzzleEditorState::Redo() {
}
bool PuzzleEditorState::CanUndo() const {
- return !undo_stack.empty();
+ return undo_stack.size();
}
bool PuzzleEditorState::CanRedo() const {
- return !redo_stack.empty();
+ return redo_stack.size();
}
void PuzzleEditorState::BrickClicked(int x, int y) {