From e2f577b5e2dcaa04f7fe739f842974f643fe9897 Mon Sep 17 00:00:00 2001 From: HappyDOGE <28511119+HappyDOGE@users.noreply.github.com> Date: Thu, 28 Jul 2022 17:48:29 +0300 Subject: [PATCH] fix placement new --- mathlib/polyhedron.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mathlib/polyhedron.cpp b/mathlib/polyhedron.cpp index 19dfd102..24ab0462 100644 --- a/mathlib/polyhedron.cpp +++ b/mathlib/polyhedron.cpp @@ -11,7 +11,9 @@ #include #include #include "tier1/utlvector.h" - +#ifdef COMPILER_MSVC +#include +#endif struct GeneratePolyhedronFromPlanes_Point; @@ -82,7 +84,7 @@ CPolyhedron_AllocByNew *CPolyhedron_AllocByNew::Allocate( unsigned short iVertic (iIndices * sizeof( Polyhedron_IndexedLineReference_t )) + (iPolygons * sizeof( Polyhedron_IndexedPolygon_t ))); - CPolyhedron_AllocByNew *pAllocated = (CPolyhedron_AllocByNew*)pMemory; + CPolyhedron_AllocByNew *pAllocated = new ( pMemory ) CPolyhedron_AllocByNew; pAllocated->iVertexCount = iVertices; pAllocated->iLineCount = iLines;