From feac221b4d98c7cffe7b038c36a5fcf924a2f39a Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 18 Sep 2022 02:16:53 -0400 Subject: [PATCH] Implement rstl::optional_object_null --- include/rstl/optional_object.hpp | 3 +++ src/MetroidPrime/ScriptObjects/CScriptPlatform.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/rstl/optional_object.hpp b/include/rstl/optional_object.hpp index 7ed5330e..6b9271ba 100644 --- a/include/rstl/optional_object.hpp +++ b/include/rstl/optional_object.hpp @@ -6,10 +6,13 @@ #include "rstl/construct.hpp" namespace rstl { +struct optional_object_null {}; + template < typename T > class optional_object { public: optional_object() : m_valid(false) {} + optional_object(optional_object_null) : m_valid(false) {} optional_object(const T& item) : m_valid(true) { rstl::construct< T >(m_data, item); } optional_object(const optional_object& other) : m_valid(other.m_valid) { if (other.m_valid) { diff --git a/src/MetroidPrime/ScriptObjects/CScriptPlatform.cpp b/src/MetroidPrime/ScriptObjects/CScriptPlatform.cpp index df622dd1..652ff5a3 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptPlatform.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptPlatform.cpp @@ -107,6 +107,6 @@ rstl::optional_object< CAABox > CScriptPlatform::GetTouchBounds() const { return GetBoundingBox(); } } else { - return rstl::optional_object< CAABox >(); + return rstl::optional_object_null(); } }