qbsp: fix iterator debug assertion in ChopBrushes

"cannot decrement begin list iterator"
This commit is contained in:
Eric Wasylishen 2022-08-27 14:39:27 -06:00
parent 2f7ca41638
commit 1ab6cc1e65
2 changed files with 12 additions and 3 deletions

View File

@ -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();

View File

@ -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");