summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-08 22:48:19 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-08 22:48:19 +0100
commitaceb0a84b4abaa4e631d317c6cd0d02b0aa0bdbd (patch)
tree79d4335c1be282ad6a76bd7834d585ce4418989a
parent24209b545e061caf601fbdd473936ccba2d95ceb (diff)
style issues
-rw-r--r--compat/vector-wrapper-fwd.hpp16
-rw-r--r--compat/vector-wrapper.hpp9
-rw-r--r--loader/scenery.cpp (renamed from loader/json.cpp)0
-rw-r--r--loader/wall-cell.hpp3
-rw-r--r--src/path-search-result.hpp4
5 files changed, 26 insertions, 6 deletions
diff --git a/compat/vector-wrapper-fwd.hpp b/compat/vector-wrapper-fwd.hpp
new file mode 100644
index 00000000..4e4ab371
--- /dev/null
+++ b/compat/vector-wrapper-fwd.hpp
@@ -0,0 +1,16 @@
+#pragma once
+
+namespace floormat {
+
+template<typename T> struct vector_wrapper;
+
+enum class vector_wrapper_repr : uint8_t // todo! use this
+{
+ invalid,
+ lvalue_reference_to_vector,
+ const_reference_to_vector,
+ vector,
+ //rvalue_reference_to_vector,
+};
+
+} // namespace floormat
diff --git a/compat/vector-wrapper.hpp b/compat/vector-wrapper.hpp
index 1b6f0617..cb6e7549 100644
--- a/compat/vector-wrapper.hpp
+++ b/compat/vector-wrapper.hpp
@@ -1,4 +1,5 @@
#pragma once
+#include "vector-wrapper-fwd.hpp" // todo!
#include <vector>
namespace floormat {
@@ -6,10 +7,10 @@ namespace floormat {
template<typename T>
struct vector_wrapper final
{
- using vector_type = std::conditional_t<std::is_const_v<T>,
- const std::vector<std::remove_const_t<T>>,
- std::vector<T>>;
- vector_type& vec;
+ using vector_type = std::conditional_t<std::is_const_v<T>, const std::vector<std::remove_const_t<T>>, std::vector<T>>;
+ using qualified_type = std::conditional_t<std::is_const_v<T>, vector_type, vector_type&>;
+
+ qualified_type vec;
};
} // namespace floormat
diff --git a/loader/json.cpp b/loader/scenery.cpp
index d374571c..d374571c 100644
--- a/loader/json.cpp
+++ b/loader/scenery.cpp
diff --git a/loader/wall-cell.hpp b/loader/wall-cell.hpp
index 3dfa698b..507a09c2 100644
--- a/loader/wall-cell.hpp
+++ b/loader/wall-cell.hpp
@@ -1,4 +1,5 @@
#pragma once
+#include "compat/vector-wrapper-fwd.hpp"
#include <memory>
#include <Corrade/Containers/String.h>
@@ -10,6 +11,8 @@ struct wall_cell
{
String name;
std::shared_ptr<wall_atlas> atlas;
+
+ static vector_wrapper<const wall_cell> load_atlases_from_json();
};
} // namespace floormat
diff --git a/src/path-search-result.hpp b/src/path-search-result.hpp
index 8987a041..b12b23d3 100644
--- a/src/path-search-result.hpp
+++ b/src/path-search-result.hpp
@@ -1,11 +1,11 @@
#pragma once
-#include "src/global-coords.hpp"
#include "compat/defs.hpp"
+#include "compat/vector-wrapper-fwd.hpp"
+#include "src/global-coords.hpp"
#include <Corrade/Containers/Pointer.h>
namespace floormat {
-template<typename T> struct vector_wrapper;
struct point;
struct path_search_result final