Merge branch 'small-fixes' into 'master'

Small fixes

See merge request Mergul/bubel-ecs!21
This commit is contained in:
Dawid Masiukiewicz 2022-07-09 20:27:01 +00:00
commit bd2afce19a
13 changed files with 46 additions and 29 deletions

View file

@ -23,7 +23,7 @@ build_code:
test_dmd_debug:
stage: test
image: frolvlad/alpine-glibc
image: debian:buster-slim
script:
- binaries/dmd_debug_unittest
artifacts:
@ -31,7 +31,7 @@ test_dmd_debug:
junit: test_report.xml
test_dmd:
stage: test
image: frolvlad/alpine-glibc
image: debian:buster-slim
script:
- binaries/dmd_release_unittest
artifacts:
@ -39,7 +39,7 @@ test_dmd:
junit: test_report.xml
test_dmd_betterC:
stage: test
image: frolvlad/alpine-glibc
image: debian:buster-slim
script:
- binaries/dmd_debug_unittest_bc
artifacts:

View file

@ -19,7 +19,7 @@ sdl2_image_dep = dependency('SDL2_image')
subdir('utils') # Utils library
executable('decs-demos', [demos_src, external_src],
executable('BubelECSDemos', [demos_src, external_src],
include_directories : [demos_inc, external_inc],
d_module_versions : versions,
link_with : [ecs_lib, ecs_utils_lib],

View file

@ -1,6 +1,6 @@
{
"name": "bubel_ecs",
"targetName" : "bubel_ecs",
"name": "bubel-ecs",
"targetName" : "BubelECS",
"authors": [
"Michał Masiukiewicz", "Dawid Masiukiewicz"
],

View file

@ -1,4 +1,4 @@
project('decs', 'd', version : '0.5.0')
project('bubel-ecs', 'd', version : '0.5.0')
# Options
betterC_opt = get_option('betterC')
@ -55,18 +55,18 @@ add_project_link_arguments(link_args, language : 'd')
# Dependencies
threads_dep = dependency('threads')
ecs_lib = library('decs',
ecs_lib = library('BubelECS',
src,
include_directories : [inc],
)
decs_dep = declare_dependency(
bubel_ecs_dep = declare_dependency(
include_directories : [inc],
link_with : ecs_lib,
dependencies : threads_dep,
)
meson.override_dependency('decs', decs_dep)
meson.override_dependency('bubel-ecs', bubel_ecs_dep)
# Tests
if BuildTests_opt

View file

@ -1,3 +1,7 @@
/************************************************************************************************************************
Copyright: Copyright © 2018-2019, Dawid Masiukiewicz, Michał Masiukiewicz
License: BSD 3-clause, see LICENSE file in project root folder.
*/
module bubel.ecs.events;
import bubel.ecs.block_allocator;

View file

@ -1,4 +1,8 @@
module bubel.ecs.hash_map;
/************************************************************************************************************************
Copyright: Copyright © 2018-2019, Dawid Masiukiewicz, Michał Masiukiewicz
License: BSD 3-clause, see LICENSE file in project root folder.
*/
module bubel.ecs.hash_map;
import std.traits;
@ -332,36 +336,36 @@ nothrow:
return result;
}
export int byKey(scope int delegate(Key k) nothrow dg)
export int byKey(scope int delegate(ref Key k) dg)
{
int result;
foreach (ref Key k; this)
{
result = dg(k);
result = (cast(int delegate(ref Key k) nothrow)dg)(k);
if (result)
break;
}
return result;
}
export int byValue(scope int delegate(ref Value k) nothrow dg)
export int byValue(scope int delegate(ref Value v) dg)
{
int result;
foreach (ref Value v; this)
{
result = dg(v);
result = (cast(int delegate(ref Value v) nothrow)dg)(v);
if (result)
break;
}
return result;
}
export int byKeyValue(scope int delegate(ref Key k, ref Value v) nothrow dg)
export int byKeyValue(scope int delegate(ref Key k, ref Value v) dg)
{
int result;
foreach (ref Key k, ref Value v; this)
{
result = dg(k, v);
result = (cast(int delegate(ref Key k, ref Value v) nothrow)dg)(k, v);
if (result)
break;
}

View file

@ -1,3 +1,7 @@
/************************************************************************************************************************
Copyright: Copyright © 2018-2019, Dawid Masiukiewicz, Michał Masiukiewicz
License: BSD 3-clause, see LICENSE file in project root folder.
*/
module bubel.ecs.id_manager;
import bubel.ecs.entity;

View file

@ -80,8 +80,6 @@ export struct EntityManager
{
UpdatePass* pass = Mallocator.make!UpdatePass;
pass.name = Mallocator.makeArray(cast(char[]) "update");
//pass.name = Mallocator.makeArray!char("update".length);
//pass.name[0..$] = "update";
passes.add(pass);
passes_map.add(cast(string) pass.name, cast(ushort)(passes.length - 1));
}
@ -297,7 +295,6 @@ export struct EntityManager
if (threads_count == 0)
threads_count = 1;
threads = Mallocator.makeArray!ThreadData(threads_count);
//foreach(ref thread;threads)thread = ThreadData().init;
m_page_size = page_size;
m_pages_in_block = block_pages_count;
@ -1253,8 +1250,6 @@ export struct EntityManager
{
UpdatePass* pass = Mallocator.make!UpdatePass;
pass.name = Mallocator.makeArray(cast(char[]) name);
/*pass.name = Mallocator.makeArray!char(name.length);
pass.name[0..$] = name[0..$];*/
passes.add(pass);
passes_map.add(name, cast(ushort)(passes.length - 1));
return cast(ushort)(passes.length - 1);
@ -1849,8 +1844,6 @@ export struct EntityManager
info = Mallocator.make!EntityInfo;
info.components = Mallocator.makeArray(ids);
/*info.components = Mallocator.makeArray!ushort(ids.length);
info.components[0 .. $] = ids[0 .. $];*/
info.deltas = Mallocator.makeArray!ushort(ids[$ - 1] + 1);
info.size = EntityID.sizeof;
@ -3226,8 +3219,6 @@ export struct EntityManager
if (index > 0)
{
caller.exclusion = Mallocator.makeArray(exclusion[0 .. index]);
/*caller.exclusion = Mallocator.makeArray!(SystemCaller*)(index);
caller.exclusion[0..$] = exclusion[0 .. index];*/
}
else
caller.exclusion = null;
@ -3275,8 +3266,6 @@ export struct EntityManager
if (index > 0)
{
caller.dependencies = Mallocator.makeArray(exclusion[0 .. index]);
/*caller.dependencies = Mallocator.makeArray!(SystemCaller*)(index);
caller.dependencies[0..$] = exclusion[0 .. index];*/
caller.job_group.dependencies = Mallocator.makeArray!(JobGroup*)(index);
foreach (j, dep; caller.dependencies)

View file

@ -1,3 +1,7 @@
/************************************************************************************************************************
Copyright: Copyright © 2018-2019, Dawid Masiukiewicz, Michał Masiukiewicz
License: BSD 3-clause, see LICENSE file in project root folder.
*/
module ecs;
public import bubel.ecs.core;

View file

@ -1,3 +1,7 @@
/************************************************************************************************************************
Copyright: Copyright © 2018-2019, Dawid Masiukiewicz, Michał Masiukiewicz
License: BSD 3-clause, see LICENSE file in project root folder.
*/
module bubel.ecs.simple_vector;
import bubel.ecs.std;

View file

@ -1,3 +1,7 @@
/************************************************************************************************************************
Copyright: Copyright © 2018-2019, Dawid Masiukiewicz, Michał Masiukiewicz
License: BSD 3-clause, see LICENSE file in project root folder.
*/
module bubel.ecs.traits;
import std.traits;

View file

@ -1,3 +1,7 @@
/************************************************************************************************************************
Copyright: Copyright © 2018-2019, Dawid Masiukiewicz, Michał Masiukiewicz
License: BSD 3-clause, see LICENSE file in project root folder.
*/
module bubel.ecs.vector;
import core.bitop;

View file

@ -10,7 +10,7 @@ tests_src = files(
'vector.d'
)
exe = executable('decs-tests',
exe = executable('BubelECSTests',
tests_src,
include_directories : [inc, include_directories('..')],
d_args : args,