Add moveDtor to properly manage lifecycle
This commit is contained in:
@@ -8,6 +8,10 @@ ecs_entity_t renderDebugPathSystem;
|
||||
ECS_DTOR(SpatialGridID, gridID, {
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
bzSpatialGridRemove(game->entityGrid, *gridID);
|
||||
bzLogInfo("Removed");
|
||||
})
|
||||
ECS_MOVE(SpatialGridID, dst, src, {
|
||||
*dst = *src;
|
||||
})
|
||||
ECS_DTOR(Path, path, {
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
@@ -19,13 +23,18 @@ ECS_DTOR(Path, path, {
|
||||
cur = cur->next;
|
||||
}
|
||||
})
|
||||
ECS_MOVE(Path, dst, src, {
|
||||
*dst = *src;
|
||||
})
|
||||
|
||||
void setupSystems() {
|
||||
ecs_set_hooks(ECS, SpatialGridID, {
|
||||
.dtor = ecs_dtor(SpatialGridID)
|
||||
.dtor = ecs_dtor(SpatialGridID),
|
||||
.move_dtor = ecs_move(SpatialGridID)
|
||||
});
|
||||
ecs_set_hooks(ECS, Path, {
|
||||
.dtor = ecs_dtor(Path)
|
||||
.dtor = ecs_dtor(Path),
|
||||
.move_dtor = ecs_move(Path)
|
||||
});
|
||||
|
||||
ECS_OBSERVER(ECS, entityPathRemove, EcsOnRemove, Path);
|
||||
|
||||
Reference in New Issue
Block a user