diff --git a/engine/engine_conf.h b/engine/engine_conf.h index f4ef7b2..7874746 100644 --- a/engine/engine_conf.h +++ b/engine/engine_conf.h @@ -2,13 +2,16 @@ #define _ENGINE_CONF_H #define MEMORY_ARENA_SIZE_MB 16 +#define MAX_N_COMPONENTS 20 +#define MAX_ENTITIES 2047 +#define MAX_COMP_POOL_SIZE MAX_ENTITIES +#define INVALID_COMP_IDX MAX_COMP_POOL_SIZE // Take care tuning these params. Web build doesn't work // if memory used too high #define MAX_SCENES_TO_RENDER 8 #define MAX_RENDER_LAYERS 4 #define MAX_RENDERMANAGER_DEPTH 4 -#define MAX_ENTITIES 2047 #define MAX_TEXTURES 16 #define MAX_SPRITES 127 @@ -21,6 +24,4 @@ #define MAX_PARTICLES 32 #define N_TAGS 10 -#define N_COMPONENTS 20 -#define MAX_COMP_POOL_SIZE MAX_ENTITIES #endif // _ENGINE_CONF_H diff --git a/engine/memory.c b/engine/memory.c index e287a62..49fe616 100644 --- a/engine/memory.c +++ b/engine/memory.c @@ -43,7 +43,7 @@ void print_memory_info() void* new_component_generic(unsigned int comp_type, unsigned int* idx) { - assert(comp_type < N_COMPONENTS); + assert(comp_type < MAX_N_COMPONENTS); assert(comp_type < mem_impl.n_components); if (cc_size(&mem_impl.comp_mempools[comp_type].free_set) == 0) return NULL; @@ -72,7 +72,7 @@ void* get_component_generic(unsigned int comp_type, unsigned int idx) void free_component_generic(unsigned int comp_type, unsigned int idx) { - assert(comp_type < N_COMPONENTS); + assert(comp_type < MAX_N_COMPONENTS); // This just free the component from the memory pool assert(comp_type < mem_impl.n_components); if (idx >= mem_impl.comp_mempools->capacity) return;