Skip to content

Commit

Permalink
Test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Jan 22, 2024
1 parent db147a6 commit 477ef5f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 22 deletions.
3 changes: 2 additions & 1 deletion src/editor/BspRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ struct RenderEnt
vec3 angles; // support angles
int modelIdx; // -1 = point entity
EntCube* pointEntCube;
bool needAngles = false;
bool needAngles;
StudioModel* mdl;
Sprite* spr;
std::string mdlFileName;
RenderEnt() : modelMat4x4(mat4x4()), modelMat4x4_calc(mat4x4()), offset(vec3()), angles(vec3())
{
needAngles = false;
modelIdx = 0;
pointEntCube = NULL;
mdl = NULL;
Expand Down
12 changes: 11 additions & 1 deletion src/editor/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2115,6 +2115,17 @@ Bsp* Renderer::getSelectedMap()
SelectedMap = mapRenderers[0]->map;
}

// TEMP DEBUG FOR CRASH DETECT
if (SelectedMap != NULL && !mapRenderers.size())
{
if (g_verbose)
{
print_log(PRINT_RED, "CRITICAL ERROR! BAD MAP POINTER!!\n");
}

SelectedMap = NULL;
}

return SelectedMap;
}

Expand Down Expand Up @@ -2287,7 +2298,6 @@ void Renderer::addMap(Bsp* map)
{
deselectObject();
clearSelection();
selectMap(map);
if (map->ents.size())
pickInfo.SetSelectedEnt(0);
/*
Expand Down
2 changes: 1 addition & 1 deletion src/gl/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Texture::~Texture()
if (this->tex_owndata && data != NULL)
delete[] data;

auto it = std::remove(dumpTextures.begin(), dumpTextures.end(), this);
std::vector<Texture*>::iterator it = std::remove(dumpTextures.begin(), dumpTextures.end(), this);
if (it != dumpTextures.end())
{
dumpTextures.erase(it);
Expand Down
16 changes: 0 additions & 16 deletions src/gl/VertexBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include "util.h"
#include <string.h>

std::vector<VertexBuffer*> totalVertBuffers;

VertexBuffer::VertexBuffer(ShaderProgram* shaderProgram, void* dat, int numVerts, int primitive)
{
uploaded = false;
Expand All @@ -14,24 +12,10 @@ VertexBuffer::VertexBuffer(ShaderProgram* shaderProgram, void* dat, int numVerts
this->shaderProgram = shaderProgram;
this->primitive = primitive;
setData(dat, numVerts);
totalVertBuffers.push_back(this);
}

VertexBuffer::~VertexBuffer() {

auto it = std::find(totalVertBuffers.begin(), totalVertBuffers.end(), this);
if (it != totalVertBuffers.end())
{
totalVertBuffers.erase(it);
}
else
{
if (g_verbose)
{
print_log(PRINT_RED, "MISSING VERT BUFF IN TOTAL VERTS BUFF!\n");
}
}

deleteBuffer();
if (ownData && data) {
delete[] data;
Expand Down
4 changes: 1 addition & 3 deletions src/gl/VertexBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,4 @@ class VertexBuffer
GLuint vaoId;
// add attributes according to the attribute flags
void addAttributes(int attFlags);
};

extern std::vector<VertexBuffer*> totalVertBuffers;
};
Binary file not shown.

0 comments on commit 477ef5f

Please sign in to comment.