Skip to content

Commit dccc0ea

Browse files
committed
feat: new assoc api placeholder
Due to #130 taking longer than expected we are adding placeholder assoc api calls while utilising the new codegen error reporting. This means that anyone using ecsact_rt_entt will not be able to use association until #130 is merged.
1 parent 7bda631 commit dccc0ea

23 files changed

+139
-930
lines changed

MODULE.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ module(
77
bazel_dep(name = "rules_cc", version = "0.0.9")
88
bazel_dep(name = "bazel_skylib", version = "1.6.1")
99
bazel_dep(name = "rules_ecsact", version = "0.5.2")
10-
bazel_dep(name = "ecsact_runtime", version = "0.6.2")
11-
bazel_dep(name = "ecsact_lang_cpp", version = "0.4.1")
10+
bazel_dep(name = "ecsact_runtime", version = "0.6.7")
11+
bazel_dep(name = "ecsact_lang_cpp", version = "0.4.5")
1212
bazel_dep(name = "boost.mp11", version = "1.83.0.bzl.1")
1313
bazel_dep(name = "entt", version = "3.12.2")
14-
bazel_dep(name = "ecsact_codegen", version = "0.2.0")
15-
bazel_dep(name = "ecsact_cli", version = "0.3.9")
14+
bazel_dep(name = "ecsact_codegen", version = "0.3.1")
15+
bazel_dep(name = "ecsact_cli", version = "0.3.12")
1616
bazel_dep(name = "xxhash", version = "0.8.2")
1717
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
1818

README.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,3 @@ entt::basic_view<entt::entity, entt::get_t<example::Health>, entt::exclude_t<exa
3333
// EnTT view for StopHealing
3434
entt::basic_view<entt::entity, entt::get_t<example::Health, example::Healing>, entt::exclude_t<>>
3535
```
36-
37-
As soon as system association occurs there now requires multiple views to be iterated at the same time.
38-
39-
```ecsact
40-
package example;
41-
component Health { f32 value; }
42-
component Attacking { entity target; }
43-
action Attack {
44-
entity target;
45-
adds Attacking;
46-
}
47-
system AttackDamage {
48-
readonly Attacking with target {
49-
readwrite Health;
50-
}
51-
}
52-
```
53-
54-
```cpp
55-
entt::basic_view<entt::entity, entt:get_t<example::Attacking>, entt::exclude_t<>>
56-
entt::basic_view<entt::entity, entt:get_t<example::Health, ecsact::entt::association<example::Attacking, 0/*target*/>>, entt::exclude_t<>>
57-
```

ecsact/entt/detail/globals.hh

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -91,76 +91,6 @@ extern const std::unordered_map< //
9191
decltype(&ecsact_has_component)>
9292
has_component_fns;
9393

94-
/**
95-
* ecsact_system_execution_context_get fn pointers
96-
*
97-
* NOTE: This gets is filled in by ecsact_rt_entt_codegen
98-
*/
99-
extern const std::unordered_map< //
100-
ecsact_system_like_id,
101-
std::unordered_map<
102-
ecsact::entt::assoc_index,
103-
std::unordered_map< //
104-
ecsact_component_like_id,
105-
decltype(&ecsact_system_execution_context_get)>>>
106-
exec_ctx_get_fns;
107-
108-
/**
109-
* ecsact_system_execution_context_add fn pointers
110-
*
111-
* NOTE: This adds is filled in by ecsact_rt_entt_codegen
112-
*/
113-
extern const std::unordered_map< //
114-
ecsact_system_like_id,
115-
std::unordered_map<
116-
ecsact::entt::assoc_index,
117-
std::unordered_map< //
118-
ecsact_component_like_id,
119-
decltype(&ecsact_system_execution_context_add)>>>
120-
exec_ctx_add_fns;
121-
122-
/**
123-
* ecsact_system_execution_context_update fn pointers
124-
*
125-
* NOTE: This updates is filled in by ecsact_rt_entt_codegen
126-
*/
127-
extern const std::unordered_map< //
128-
ecsact_system_like_id,
129-
std::unordered_map<
130-
ecsact::entt::assoc_index,
131-
std::unordered_map< //
132-
ecsact_component_like_id,
133-
decltype(&ecsact_system_execution_context_update)>>>
134-
exec_ctx_update_fns;
135-
136-
/**
137-
* ecsact_system_execution_context_remove fn pointers
138-
*
139-
* NOTE: This removes is filled in by ecsact_rt_entt_codegen
140-
*/
141-
extern const std::unordered_map< //
142-
ecsact_system_like_id,
143-
std::unordered_map<
144-
ecsact::entt::assoc_index,
145-
std::unordered_map< //
146-
ecsact_component_like_id,
147-
decltype(&ecsact_system_execution_context_remove)>>>
148-
exec_ctx_remove_fns;
149-
150-
/**
151-
* ecsact_system_execution_context_has fn pointers
152-
*
153-
* NOTE: This has is filled in by ecsact_rt_entt_codegen
154-
*/
155-
extern const std::unordered_map< //
156-
ecsact_system_like_id,
157-
std::unordered_map<
158-
ecsact::entt::assoc_index,
159-
std::unordered_map< //
160-
ecsact_component_like_id,
161-
decltype(&ecsact_system_execution_context_has)>>>
162-
exec_ctx_has_fns;
163-
16494
/**
16595
* ecsact_system_execution_context_action fn pointers
16696
*

ecsact/entt/detail/internal_markers.hh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,6 @@
88

99
namespace ecsact::entt::detail {
1010

11-
template<typename C, std::size_t FieldOffset>
12-
struct association {
13-
using component = C;
14-
static constexpr auto field_offset = FieldOffset;
15-
std::int_fast16_t ref_count = 0;
16-
};
17-
18-
template<typename Assoc>
19-
concept association_concept = //
20-
requires {
21-
{ typename Assoc::component_type{} };
22-
{ Assoc::field_offset } -> std::convertible_to<std::size_t>;
23-
};
24-
2511
template<typename C>
2612
struct beforeremove_storage;
2713

ecsact/entt/detail/system_execution_context.hh

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,6 @@
1212
#include "ecsact/entt/entity.hh"
1313
#include "ecsact/entt/detail/registry.hh"
1414

15-
namespace ecsact::entt {
16-
/**
17-
* Opaque index representing a system-likes association where `0` means no
18-
* association.
19-
*/
20-
enum class assoc_index : unsigned;
21-
22-
constexpr auto empty_assoc_index(assoc_index n) -> bool {
23-
return n == assoc_index{};
24-
}
25-
26-
constexpr auto underlying_assoc_index(assoc_index n) -> unsigned {
27-
assert(!empty_assoc_index(n));
28-
return static_cast<unsigned>(n);
29-
}
30-
31-
} // namespace ecsact::entt
32-
3315
struct ecsact_system_execution_context {
3416
ecsact_system_like_id id;
3517
ecsact::entt::entity_id entity;
@@ -81,6 +63,6 @@ struct ecsact_system_execution_context {
8163
virtual auto parent() -> const ecsact_system_execution_context* = 0;
8264

8365
virtual auto other( //
84-
ecsact_entity_id entity
66+
ecsact_system_assoc_id assoc_id
8567
) -> ecsact_system_execution_context* = 0;
8668
};

ecsact/entt/wrapper/core.hh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ template<typename C>
1616
inline auto has_component( //
1717
ecsact_registry_id registry_id,
1818
ecsact_entity_id entity_id,
19-
[[maybe_unused]] ecsact_component_id component_id
19+
[[maybe_unused]] ecsact_component_id component_id,
20+
...
2021
) -> bool {
2122
auto& reg = ecsact::entt::get_registry(registry_id);
2223
auto entity = ecsact::entt::entity_id{entity_id};
@@ -28,7 +29,8 @@ template<typename C>
2829
inline auto get_component(
2930
ecsact_registry_id registry_id,
3031
ecsact_entity_id entity_id,
31-
[[maybe_unused]] ecsact_component_id component_id
32+
[[maybe_unused]] ecsact_component_id component_id,
33+
...
3234
) -> const void* {
3335
auto& reg = ecsact::entt::get_registry(registry_id);
3436
auto entity = ecsact::entt::entity_id{entity_id};
@@ -116,7 +118,8 @@ inline auto update_component( //
116118
ecsact_registry_id registry_id,
117119
ecsact_entity_id entity_id,
118120
[[maybe_unused]] ecsact_component_id component_id,
119-
const void* component_data
121+
const void* component_data,
122+
...
120123
) -> ecsact_update_error {
121124
using ecsact::entt::detail::exec_beforechange_storage;
122125

@@ -148,7 +151,8 @@ inline auto update_component_exec_options( //
148151
ecsact_registry_id registry_id,
149152
ecsact_entity_id entity_id,
150153
[[maybe_unused]] ecsact_component_id component_id,
151-
const void* component_data
154+
const void* component_data,
155+
...
152156
) -> ecsact_update_error {
153157
using ecsact::entt::detail::exec_beforechange_storage;
154158

@@ -184,7 +188,8 @@ template<typename C>
184188
auto remove_component(
185189
ecsact_registry_id registry_id,
186190
ecsact_entity_id entity_id,
187-
[[maybe_unused]] ecsact_component_id component_id
191+
[[maybe_unused]] ecsact_component_id component_id,
192+
...
188193
) -> void {
189194
auto& reg = ecsact::entt::get_registry(registry_id);
190195
auto entity = ecsact::entt::entity_id{entity_id};
@@ -203,7 +208,8 @@ template<typename C>
203208
auto remove_component_exec_options(
204209
ecsact_registry_id registry_id,
205210
ecsact_entity_id entity_id,
206-
[[maybe_unused]] ecsact_component_id component_id
211+
[[maybe_unused]] ecsact_component_id component_id,
212+
...
207213
) -> void {
208214
using ecsact::entt::detail::pending_remove;
209215

ecsact/entt/wrapper/dynamic.hh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ template<typename C>
7070
auto context_remove(
7171
ecsact_system_execution_context* context,
7272
[[maybe_unused]] ecsact_component_like_id component_id,
73-
auto& view
73+
auto& view,
74+
...
7475
) -> void {
7576
assert(ecsact_id_cast<ecsact_component_like_id>(C::id) == component_id);
7677

@@ -125,7 +126,8 @@ auto context_get(
125126
ecsact_system_execution_context* context,
126127
[[maybe_unused]] ecsact_component_like_id component_id,
127128
void* out_component_data,
128-
auto& view
129+
auto& view,
130+
...
129131
) -> void {
130132
auto entity = context->entity;
131133

@@ -158,7 +160,8 @@ auto context_update(
158160
template<typename C>
159161
auto context_has(
160162
ecsact_system_execution_context* context,
161-
[[maybe_unused]] ecsact_component_like_id component_id
163+
[[maybe_unused]] ecsact_component_like_id component_id,
164+
...
162165
) -> bool {
163166
auto entity = context->entity;
164167
auto& registry = *context->registry;

rt_entt_codegen/core/print_sys_exec.cc

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static auto print_sys_exec_ctx_action(
6262
});
6363

6464
if(result == system_providers.end()) {
65-
throw std::logic_error("print context action was not handled by providers");
65+
ctx.fatal("INTERNAL: print context action was not handled by providers");
6666
}
6767
}
6868

@@ -83,7 +83,7 @@ static auto print_sys_exec_ctx_add(
8383
});
8484

8585
if(result == system_providers.end()) {
86-
throw std::logic_error("print context add was not handled by providers");
86+
ctx.fatal("INTERNAL: print context add was not handled by providers");
8787
}
8888
}
8989

@@ -103,7 +103,7 @@ static auto print_sys_exec_ctx_remove(
103103
});
104104

105105
if(result == system_providers.end()) {
106-
throw std::logic_error("print context remove was not handled by providers");
106+
ctx.fatal("INTERNAL: print context remove was not handled by providers");
107107
}
108108
}
109109

@@ -124,7 +124,7 @@ static auto print_sys_exec_ctx_get(
124124
});
125125

126126
if(result == system_providers.end()) {
127-
throw std::logic_error("print context get was not handled by providers");
127+
ctx.fatal("INTERNAL: print context get was not handled by providers");
128128
}
129129
}
130130

@@ -145,7 +145,7 @@ static auto print_sys_exec_ctx_update(
145145
});
146146

147147
if(result == system_providers.end()) {
148-
throw std::logic_error("print context update was not handled by providers");
148+
ctx.fatal("INTERNAL: print context update was not handled by providers");
149149
}
150150
}
151151

@@ -165,7 +165,7 @@ static auto print_sys_exec_ctx_has(
165165
});
166166

167167
if(result == system_providers.end()) {
168-
throw std::logic_error("print context has was not handled by providers");
168+
ctx.fatal("INTERNAL: print context has was not handled by providers");
169169
}
170170
}
171171

@@ -187,8 +187,7 @@ static auto print_sys_exec_ctx_generate(
187187
});
188188

189189
if(result == system_providers.end()) {
190-
throw std::logic_error("print context generate was not handled by providers"
191-
);
190+
ctx.fatal("INTERNAL: print context generate was not handled by providers");
192191
}
193192
}
194193

@@ -207,7 +206,7 @@ static auto print_sys_exec_ctx_parent( //
207206
});
208207

209208
if(result == system_providers.end()) {
210-
throw std::logic_error("print context parent was not handled by providers");
209+
ctx.fatal("INTERNAL: print context parent was not handled by providers");
211210
}
212211
}
213212

@@ -218,7 +217,7 @@ auto print_sys_exec_ctx_other(
218217
) -> void {
219218
auto printer = //
220219
method_printer{ctx, "other"}
221-
.parameter("ecsact_entity_id", "entity")
220+
.parameter("ecsact_system_assoc_id", "assoc_id")
222221
.return_type("ecsact_system_execution_context* final");
223222

224223
auto result = std::ranges::find_if(system_providers, [&](auto provider) {
@@ -227,7 +226,7 @@ auto print_sys_exec_ctx_other(
227226
});
228227

229228
if(result == system_providers.end()) {
230-
throw std::logic_error("print context other was not handled by providers");
229+
ctx.fatal("INTERNAL: print context other was not handled by providers");
231230
}
232231
}
233232

@@ -353,10 +352,6 @@ static auto setup_system_providers(system_like_id_variant sys_like_id
353352
system_providers.push_back(std::make_shared<lazy>(sys_like_id));
354353
}
355354

356-
if(!sys_details.association_details.empty()) {
357-
system_providers.push_back(std::make_shared<association>(sys_like_id));
358-
}
359-
360355
if(can_entities_parallel(sys_like_id)) {
361356
system_providers.push_back(std::make_shared<parallel>(sys_like_id));
362357
}
@@ -443,7 +438,7 @@ static auto print_execute_systems(
443438
});
444439

445440
if(result == system_providers.end()) {
446-
throw std::logic_error("system_impl was not handled by providers");
441+
ctx.fatal("INTERNAL: system_impl was not handled by providers");
447442
}
448443
}
449444

0 commit comments

Comments
 (0)