Refactor State::restore_points_on_tri_del(...)
All checks were successful
Run UnitTests / build-and-run-tests (push) Successful in 31s

This commit is contained in:
Stephen Seo 2024-01-25 11:21:28 +09:00
parent 852a099930
commit b8d4521223

View file

@ -669,17 +669,17 @@ void Tri::State::restore_points_on_tri_del(Action::IndexT end) {
pointCircle.fillColor = history[end].color; pointCircle.fillColor = history[end].color;
unsigned int currentTriIdx = 1; unsigned int currentTriIdx = 1;
while(end-- > 0) { while(end-- > 0) {
if(history[end].type == Action::AT_POINT) { assert(history[end].type == Action::AT_POINT
assert(history[end].idx == currentTriIdx && "Latest history must be AT_POINT type");
&& "Last point must be second point"); assert(history[end].idx == currentTriIdx
currentTri[currentTriIdx].x = history[end].data.point[0]; && "Last point must be second point");
currentTri[currentTriIdx].y = history[end].data.point[1]; currentTri[currentTriIdx].x = history[end].data.point[0];
if(currentTriIdx > 0) { currentTri[currentTriIdx].y = history[end].data.point[1];
--currentTriIdx; if(currentTriIdx > 0) {
} else { --currentTriIdx;
currentTri_state = CurrentState::SECOND; } else {
return; currentTri_state = CurrentState::SECOND;
} return;
} }
} }