Recast: make sure shape editor and shape instance max vert count is always the same

Use the same constant for class ShapeVolumeTool and struct ShapeVolume, since we do plan on increasing this in the future. Having multiple constants can cause hard to find problems when tweaking this.
This commit is contained in:
Kawe Mazidjatari 2024-09-22 00:40:12 +02:00
parent be27f75442
commit e9e1a96310
2 changed files with 7 additions and 7 deletions

View File

@ -275,7 +275,7 @@ void ShapeVolumeTool::handleClick(const float* /*s*/, const float* p, bool shift
if (m_nhull > 2)
{
// Create shape.
float verts[MAX_PTS*3];
float verts[MAX_SHAPEVOL_PTS*3];
for (int i = 0; i < m_nhull; ++i)
rdVcopy(&verts[i*3], &m_pts[m_hull[i]*3]);
@ -287,8 +287,8 @@ void ShapeVolumeTool::handleClick(const float* /*s*/, const float* p, bool shift
if (m_convexOffset > 0.01f)
{
float offset[MAX_PTS*2*3];
const int noffset = rcOffsetPoly(verts, m_nhull, m_convexOffset, offset, MAX_PTS*2);
float offset[MAX_SHAPEVOL_PTS*2*3];
const int noffset = rcOffsetPoly(verts, m_nhull, m_convexOffset, offset, MAX_SHAPEVOL_PTS*2);
if (noffset > 0)
geom->addConvexVolume(offset, noffset, minh, maxh, (unsigned short)m_polyFlags, (unsigned char)m_areaType);
}
@ -304,7 +304,7 @@ void ShapeVolumeTool::handleClick(const float* /*s*/, const float* p, bool shift
else
{
// Add new point
if (m_npts < MAX_PTS)
if (m_npts < MAX_SHAPEVOL_PTS)
{
rdVcopy(&m_pts[m_npts*3], p);
m_npts++;

View File

@ -20,6 +20,7 @@
#define SHAPEVOLUMETOOL_H
#include "NavEditor/Include/Editor.h"
#include "NavEditor/Include/InputGeom.h"
// Tool to create shape volumes for InputGeom
@ -40,10 +41,9 @@ class ShapeVolumeTool : public EditorTool
float m_convexHeight;
float m_convexDescent;
static const int MAX_PTS = 12;
float m_pts[MAX_PTS*3];
float m_pts[MAX_SHAPEVOL_PTS*3];
int m_npts;
int m_hull[MAX_PTS];
int m_hull[MAX_SHAPEVOL_PTS];
int m_nhull;
public: