Skip to content

Commit b91a459

Browse files
authored
chore: little bit of cleanup (#55)
1 parent 96d175e commit b91a459

File tree

2 files changed

+34
-36
lines changed

2 files changed

+34
-36
lines changed

ecsact/entt/detail/registry_info.hh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
#include "ecsact/runtime/common.h"
1010
#include "ecsact/runtime/core.h"
1111
#include "ecsact/entt/detail/meta_util.hh"
12-
12+
#include "ecsact/cpp/type_info.hh"
13+
#include "ecsact/entt/system_view.hh"
1314
#include "ecsact/entt/event_markers.hh"
1415
#include "ecsact/entt/detail/internal_markers.hh"
1516

17+
#include "meta_util.hh"
18+
1619
namespace ecsact_entt_rt {
1720
using entity_id_map_t = std::unordered_map<ecsact_entity_id, entt::entity>;
1821

ecsact/entt/system_view.hh

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,46 +22,41 @@ auto system_view_helper(
2222

2323
namespace ecsact::entt {
2424

25+
template<
26+
typename SystemCapabilitiesInfo,
27+
typename ExtraGetTypes = ::ecsact::mp_list<>>
28+
using view_get_types = boost::mp11::mp_unique<boost::mp11::mp_flatten<
29+
boost::mp11::mp_push_back<
30+
typename SystemCapabilitiesInfo::readonly_components,
31+
typename SystemCapabilitiesInfo::readwrite_components,
32+
typename SystemCapabilitiesInfo::include_components,
33+
typename SystemCapabilitiesInfo::removes_components,
34+
ExtraGetTypes,
35+
boost::mp11::mp_transform<
36+
detail::beforechange_storage,
37+
typename SystemCapabilitiesInfo::readwrite_components>>,
38+
::ecsact::mp_list<>>>;
39+
40+
template<
41+
typename SystemCapabilitiesInfo,
42+
typename ExtraExcludeTypes = ::ecsact::mp_list<>>
43+
using view_exclude_types = boost::mp11::mp_unique<boost::mp11::mp_flatten<
44+
boost::mp11::mp_push_back<
45+
typename SystemCapabilitiesInfo::exclude_components,
46+
typename SystemCapabilitiesInfo::adds_components,
47+
ExtraExcludeTypes>,
48+
::ecsact::mp_list<>>>;
49+
2550
template<
2651
typename SystemCapabilitiesInfo,
2752
typename ExtraGetTypes = ::ecsact::mp_list<>,
2853
typename ExtraExcludeTypes = ::ecsact::mp_list<>>
2954
auto view_from_system_capabilities(::entt::registry& registry) {
30-
using caps_info = SystemCapabilitiesInfo;
31-
32-
using boost::mp11::mp_assign;
33-
using boost::mp11::mp_flatten;
34-
using boost::mp11::mp_map_find;
35-
using boost::mp11::mp_push_back;
36-
using boost::mp11::mp_transform;
37-
using boost::mp11::mp_unique;
38-
using ecsact::entt_mp11_util::mp_map_find_value_or;
39-
40-
using ecsact::entt::detail::beforechange_storage;
41-
using ecsact::entt::detail::temp_storage;
42-
43-
using readonly_components = typename caps_info::readonly_components;
44-
using readwrite_components = typename caps_info::readwrite_components;
45-
using removes_components = typename caps_info::removes_components;
46-
using adds_components = typename caps_info::adds_components;
47-
using include_components = typename caps_info::include_components;
48-
using exclude_components = typename caps_info::exclude_components;
49-
50-
using get_types = mp_unique<mp_flatten<
51-
mp_push_back<
52-
readonly_components,
53-
readwrite_components,
54-
include_components,
55-
removes_components,
56-
ExtraGetTypes,
57-
mp_transform<beforechange_storage, readwrite_components>>,
58-
::ecsact::mp_list<>>>;
59-
60-
using exclude_types = mp_unique<mp_flatten<
61-
mp_push_back<exclude_components, adds_components, ExtraExcludeTypes>,
62-
::ecsact::mp_list<>>>;
63-
64-
return detail::system_view_helper(get_types{}, exclude_types{}, registry);
55+
return detail::system_view_helper(
56+
view_get_types<SystemCapabilitiesInfo, ExtraGetTypes>{},
57+
view_exclude_types<SystemCapabilitiesInfo, ExtraExcludeTypes>{},
58+
registry
59+
);
6560
}
6661

6762
template<

0 commit comments

Comments
 (0)