diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c77cec..ae6a3b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ include( CheckCXXCompilerFlag ) project( ZDRay ) -SET( CMAKE_CXX_STANDARD 14 ) +SET( CMAKE_CXX_STANDARD 17 ) IF( NOT CMAKE_BUILD_TYPE ) SET( CMAKE_BUILD_TYPE Debug CACHE STRING diff --git a/src/level/doomdata.h b/src/level/doomdata.h index 1b46399..a39518e 100644 --- a/src/level/doomdata.h +++ b/src/level/doomdata.h @@ -7,6 +7,7 @@ #include "math/mathlib.h" #include #include +#include #undef MIN #undef MAX #undef min @@ -346,15 +347,15 @@ struct ThingLight MapSubsectorEx *ssect; // Portal related functionality - vec3 relativePosition = vec3(0); + std::optional relativePosition; int sectorGroup = 0; // Portal aware position vec3 LightRelativeOrigin() const { - if (relativePosition != vec3(0)) + if (relativePosition) { - return relativePosition; + return *relativePosition; } return LightOrigin(); } diff --git a/src/lightmap/levelmesh.cpp b/src/lightmap/levelmesh.cpp index 762975a..7372f63 100644 --- a/src/lightmap/levelmesh.cpp +++ b/src/lightmap/levelmesh.cpp @@ -205,7 +205,7 @@ void LevelMesh::PropagateLight(FLevel& doomMap, ThingLight *light) { auto fakeLight = std::make_unique(*light); - fakeLight->relativePosition = portal->TransformPosition(light->LightRelativeOrigin()); + fakeLight->relativePosition.emplace(portal->TransformPosition(light->LightRelativeOrigin())); fakeLight->sectorGroup = portal->targetSectorGroup; PropagateLight(doomMap, fakeLight.get());