Skip to content

Commit

Permalink
misc fixes
Browse files Browse the repository at this point in the history
- fix paste crashing program if copied before opening/merging a map
- fix merge failing if AllocBlock was at 63/64 usage
  • Loading branch information
wootguy committed Apr 30, 2024
1 parent 1514b27 commit 159bd58
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/bsp/Bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3468,8 +3468,7 @@ bool Bsp::isValid() {
&& textureCount < g_limits.max_textures
&& lightDataLength < g_limits.max_lightdata
&& visDataLength < g_limits.max_visdata
&& ents.size() < g_limits.max_entities
&& ceilf(calc_allocblock_usage()) < g_limits.max_allocblocks;
&& ceilf(calc_allocblock_usage()) <= g_limits.max_allocblocks;
}

bool Bsp::validate_vis_data() {
Expand Down
15 changes: 15 additions & 0 deletions src/editor/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,11 @@ void Renderer::reloadMaps() {

clearUndoCommands();
clearRedoCommands();

if (copiedEnt != NULL) {
delete copiedEnt;
copiedEnt = NULL;
}

logf("Reloaded maps\n");
}
Expand All @@ -575,6 +580,11 @@ void Renderer::openMap(const char* fpath) {
pickInfo.valid = false;
addMap(new Bsp(fpath));

if (copiedEnt != NULL) {
delete copiedEnt;
copiedEnt = NULL;
}

clearUndoCommands();
clearRedoCommands();
gui->refresh();
Expand Down Expand Up @@ -3105,6 +3115,11 @@ void Renderer::merge(string fpath) {
pickInfo.valid = false;
addMap(mergeResult.map);

if (copiedEnt != NULL) {
delete copiedEnt;
copiedEnt = NULL;
}

clearUndoCommands();
clearRedoCommands();
gui->refresh();
Expand Down

0 comments on commit 159bd58

Please sign in to comment.