Skip to content

Commit

Permalink
fix duplicate model crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Karaulov committed Nov 27, 2022
1 parent 9034522 commit 380a9ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/bsp/Bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4330,8 +4330,6 @@ void Bsp::copy_bsp_model(int modelIdx, Bsp* targetMap, STRUCTREMAP& remap, std::
STRUCTUSAGE usage(this);
mark_model_structures(modelIdx, &usage, true);

remap = STRUCTREMAP(this);

for (unsigned int i = 0; i < usage.count.planes; i++)
{
if (usage.planes[i])
Expand Down Expand Up @@ -4480,7 +4478,7 @@ int Bsp::duplicate_model(int modelIdx)
std::vector<BSPNODE> newNodes;
std::vector<BSPCLIPNODE> newClipnodes;

STRUCTREMAP remap;
STRUCTREMAP remap(this);

copy_bsp_model(modelIdx, this, remap, newPlanes, newVerts, newEdges, newSurfedges, newTexinfo, newFaces, newLightmaps, newNodes, newClipnodes);

Expand Down
4 changes: 2 additions & 2 deletions src/editor/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4021,9 +4021,9 @@ void Gui::drawImportMapWidget()
std::vector<BSPNODE> newNodes;
std::vector<BSPCLIPNODE> newClipnodes;

STRUCTREMAP* remap = new STRUCTREMAP();
STRUCTREMAP remap(map);

bspModel->copy_bsp_model(0, map, *remap, newPlanes, newVerts, newEdges, newSurfedges, newTexinfo, newFaces, newLightmaps, newNodes, newClipnodes);
bspModel->copy_bsp_model(0, map, remap, newPlanes, newVerts, newEdges, newSurfedges, newTexinfo, newFaces, newLightmaps, newNodes, newClipnodes);

if (newClipnodes.size())
map->append_lump(LUMP_CLIPNODES, &newClipnodes[0], sizeof(BSPCLIPNODE) * newClipnodes.size());
Expand Down

0 comments on commit 380a9ae

Please sign in to comment.