summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-09-26 19:46:24 -0400
committerJonathan Bradley <jcb@pikum.xyz>2023-09-26 19:46:24 -0400
commitf0e3999bbc20cd72fe1f50539e3b523325b0db16 (patch)
tree720dfd08602060e722af99cc3afcfd80eb4a3a57 /src
parent517dedc6a05c9048fa57eae7e7c907452b408069 (diff)
off by one for ECS counts
Diffstat (limited to 'src')
-rw-r--r--src/ecs.cpp4
-rw-r--r--src/game.cpp2
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++) {