From f0e3999bbc20cd72fe1f50539e3b523325b0db16 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Tue, 26 Sep 2023 19:46:24 -0400 Subject: off by one for ECS counts --- src/ecs.cpp | 4 ++-- src/game.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ecs.cpp b/src/ecs.cpp index 9d7b321..bbb1a70 100644 --- a/src/ecs.cpp +++ b/src/ecs.cpp @@ -38,7 +38,7 @@ void ECS_Init() { } uint64_t ECS_GetEntities_BucketCount() { - return Entities_BucketContainer.bucketCounter; + return Entities_BucketContainer.bucketCounter + 1; } Entity *ECS_GetEntities(uint64_t bucketIndex, uint64_t &itemCount) { assert(bucketIndex <= Entities_BucketContainer.bucketCounter); @@ -233,7 +233,7 @@ CompGrBinds *ECS_GetGrBinds(EntityHandle entHandle) { } uint64_t ECS_GetGrBinds_BucketCount() { - return Comp_GrBinds_BucketContainer.bucketCounter; + return Comp_GrBinds_BucketContainer.bucketCounter + 1; } CompGrBinds *ECS_GetGrBinds(uint64_t bucketIndex, uint64_t &itemCount) { diff --git a/src/game.cpp b/src/game.cpp index db81e47..9298b26 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -280,7 +280,7 @@ void RecordImGuiEntityList() { ImGui::TableHeadersRow(); uint64_t bucketCount = ECS_GetEntities_BucketCount(); - for (long bucket = 0; bucket <= bucketCount; ++bucket) { + for (long bucket = 0; bucket < bucketCount; ++bucket) { uint64_t itemCount = 0; auto *entities = ECS_GetEntities(bucket, itemCount); for (long row = 0; row < itemCount; row++) { -- cgit v1.2.3