Skip to content

Commit

Permalink
crash fixes
Browse files Browse the repository at this point in the history
- viewing keyvalues for an entity with more than 64 fgd keys
- specific click combination when moving an ent for the first time
- selecting an entity in a map without VIS data with the debug widget open
  • Loading branch information
wootguy committed Jun 10, 2024
1 parent 3675051 commit 9ca8822
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/bsp/Bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4448,6 +4448,10 @@ bool Bsp::is_leaf_visible(int ileaf, vec3 pos) {
bool isVisible = false;
int numVisible = 0;

if (!pvs) {
return true;
}

//logf("leaf %d can see:", ipvsLeaf);

for (int lf = 1; lf < leafCount; p++)
Expand Down
2 changes: 1 addition & 1 deletion src/bsp/bsplimits.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define MAXTEXTURENAME 16
#define MIPLEVELS 4

#define MAX_KEYS_PER_ENT 64 // just guessing
#define MAX_KEYS_PER_ENT 256 // just guessing
#define MAX_KEY_LEN 256 // not sure if this includes the null char
#define MAX_VAL_LEN 4096 // not sure if this includes the null char

Expand Down
4 changes: 2 additions & 2 deletions src/editor/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2124,10 +2124,10 @@ void Gui::drawKeyvalueEditor_SmartEditTab(Entity* ent) {

if (fgdClass != NULL) {

static InputData inputData[128];
static InputData inputData[MAX_KEYS_PER_ENT];
static int lastPickCount = 0;

for (int i = 0; i < fgdClass->keyvalues.size() && i < 128; i++) {
for (int i = 0; i < fgdClass->keyvalues.size() && i < MAX_KEYS_PER_ENT; i++) {
KeyvalueDef& keyvalue = fgdClass->keyvalues[i];
string key = keyvalue.name;
if (key == "spawnflags") {
Expand Down
2 changes: 1 addition & 1 deletion src/editor/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ void Renderer::cameraPickingControls() {
draggingAxis = -1;
applyTransform();

if (pickInfo.valid && pickInfo.ent && undoEntityState->getOrigin() != pickInfo.ent->getOrigin()) {
if (pickInfo.valid && pickInfo.ent && undoEntityState && undoEntityState->getOrigin() != pickInfo.ent->getOrigin()) {
pushEntityUndoState("Move Entity");
}
}
Expand Down

0 comments on commit 9ca8822

Please sign in to comment.