diff --git a/qbsp/brushbsp.cc b/qbsp/brushbsp.cc index b0e9b9fe..fbd04198 100644 --- a/qbsp/brushbsp.cc +++ b/qbsp/brushbsp.cc @@ -1475,9 +1475,9 @@ newlist: if (c1 < c2) { stats.c_from_split += sub.size(); - auto before = std::prev(list.erase(b1_it)); // remove the current brush, go back one - list.splice(std::next(before), sub); // splice new list in place of where the brush was - b1_it = std::next(before); // restart list with the new brushes + auto before = list.erase(b1_it); // remove the current brush, go back one + list.splice(before, sub); // splice new list in place of where the brush was + b1_it = before; // restart list with the new brushes goto newlist; } else { stats.c_from_split += sub2.size(); diff --git a/tests/test_qbsp.cc b/tests/test_qbsp.cc index 53b58648..566e4908 100644 --- a/tests/test_qbsp.cc +++ b/tests/test_qbsp.cc @@ -1545,6 +1545,15 @@ TEST_CASE("quake maps", "[testmaps_q1][.releaseonly]") } } +TEST_CASE("chop", "[testmaps_q1]") +{ + const auto [bsp, bspx, prt] = LoadTestmapQ1("quake_map_source/DM1-test.map", {"-chop", "-debugchop"}); + + CHECK(GAME_QUAKE == bsp.loadversion->game->id); + CHECK(prt); + CheckFilled(bsp); +} + TEST_CASE("base1leak", "[testmaps_q2]") { const auto [bsp, bspx, prt] = LoadTestmapQ2("base1leak.map");