Fix entity id size to fit the entity count

This commit is contained in:
Abdelrahman Said 2025-05-24 01:57:10 +01:00
parent a7d255dba6
commit 61f66ae554

4
dod.c
View File

@ -21,7 +21,7 @@ enum EntityTag {
typedef struct Entity Entity;
struct Entity {
u16 id;
u32 id;
};
typedef struct Position Position;
@ -137,7 +137,7 @@ void init_manager(const Allocator *allocator, Manager *manager) {
assert(allocator != NULL && manager != NULL);
u64 total_count = (u64)WANDERER_COUNT + (u64)ZONE_COUNT;
total_count += 4 - (total_count % 4);
assert(total_count < (1lu << 32)); // Ensure we're not exceeding the maximum limit of entities
u64 entities_size = sizeof(Entity) * total_count;
u64 rects_size = sizeof(Rect) * total_count;