summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compat/optional.hpp25
-rw-r--r--editor/app.hpp2
-rw-r--r--editor/camera.cpp4
-rw-r--r--editor/draw.cpp4
-rw-r--r--editor/editor.hpp2
-rw-r--r--src/precomp.hpp1
6 files changed, 6 insertions, 32 deletions
diff --git a/compat/optional.hpp b/compat/optional.hpp
deleted file mode 100644
index 6f8a1a89..00000000
--- a/compat/optional.hpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#pragma once
-#include <type_traits>
-#include <Corrade/Containers/Optional.h>
-
-namespace std {
-template<class T> struct tuple_size<Corrade::Containers::Optional<T>> : std::integral_constant<std::size_t, 2> {};
-template<class T> struct tuple_element<0, Corrade::Containers::Optional<T>> { using type = T; };
-template<class T> struct tuple_element<1, Corrade::Containers::Optional<T>> { using type = bool; };
-} // namespace std
-
-namespace Corrade::Containers {
-
-template<std::size_t N, class T>
-std::tuple_element_t<N, Optional<T>>
-get(const Optional<T>& value) noexcept(std::is_nothrow_default_constructible_v<T> && std::is_nothrow_copy_constructible_v<T>)
-{
- static_assert(N < 2);
- static_assert(std::is_default_constructible_v<T> && std::is_copy_constructible_v<T>);
- if constexpr (N == 0)
- return value ? *value : T{};
- if constexpr (N == 1)
- return bool(value);
-}
-
-} // namespace Corrade::Containers
diff --git a/editor/app.hpp b/editor/app.hpp
index 25391d62..8d4f0736 100644
--- a/editor/app.hpp
+++ b/editor/app.hpp
@@ -13,7 +13,7 @@
#include <memory>
#include <Corrade/Containers/Pointer.h>
-#include "compat/optional.hpp"
+#include <Corrade/Containers/Optional.h>
#include <Magnum/ImGuiIntegration/Context.h>
namespace floormat {
diff --git a/editor/camera.cpp b/editor/camera.cpp
index d7fc8695..2df3dd20 100644
--- a/editor/camera.cpp
+++ b/editor/camera.cpp
@@ -59,8 +59,8 @@ void app::reset_camera_offset()
void app::update_cursor_tile(const Optional<Vector2i>& pixel)
{
cursor.pixel = pixel;
- if (const auto [p, b] = pixel; b)
- cursor.tile = M->pixel_to_tile(Vector2d{p});
+ if (pixel)
+ cursor.tile = M->pixel_to_tile(Vector2d{*pixel});
else
cursor.tile = NullOpt;
}
diff --git a/editor/draw.cpp b/editor/draw.cpp
index 339e0f6c..275d99fc 100644
--- a/editor/draw.cpp
+++ b/editor/draw.cpp
@@ -18,9 +18,9 @@ void app::draw_cursor()
shader.set_tint({1, 0, 0, 1});
const auto inactive_color = 0xff00ffff_rgbaf;
- if (const auto [pos, b] = cursor.tile; b && !cursor.in_imgui)
+ if (cursor.tile && !cursor.in_imgui)
{
- const auto draw = [&, pos = pos](auto& mesh, const auto& size) {
+ const auto draw = [&, pos = *cursor.tile](auto& mesh, const auto& size) {
const auto pt = pos.to_signed();
const Vector3 center{Vector3i(pt[0], pt[1], 0) * iTILE_SIZE};
mesh.draw(shader, {center, size, LINE_WIDTH});
diff --git a/editor/editor.hpp b/editor/editor.hpp
index eac544ad..d9d4d386 100644
--- a/editor/editor.hpp
+++ b/editor/editor.hpp
@@ -9,7 +9,7 @@
#include <map>
#include <memory>
-#include "compat/optional.hpp"
+#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/StringView.h>
namespace floormat {
diff --git a/src/precomp.hpp b/src/precomp.hpp
index 4808d6a2..75c4f191 100644
--- a/src/precomp.hpp
+++ b/src/precomp.hpp
@@ -34,7 +34,6 @@
#include <Corrade/Containers/Array.h>
#include <Corrade/Containers/ArrayViewStl.h>
#include <Corrade/Containers/EnumSet.h>
-#include "compat/optional.hpp"
#include <Corrade/Containers/Pointer.h>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/Containers/StringStlHash.h>