Fix entity id size to fit the entity count
This commit is contained in:
		
							
								
								
									
										4
									
								
								dod.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								dod.c
									
									
									
									
									
								
							@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user