boids-playground/src/boid-list.hpp

33 lines
742 B
C++

#pragma once
#include <inttypes.h>
#include "boid-playground.hpp"
#include "memory-arena.hpp"
#define BOIDS_PER_NODE 64
struct BoidListNode {
BoidListNode *next;
uboid_t boid_ids[BOIDS_PER_NODE];
};
struct BoidList {
BoidListNode node;
uboid_t count;
};
struct BoidsListNodeIterator {
uboid_t count;
int i;
BoidListNode *node;
};
BoidsListNodeIterator boid_list_get_iterator(BoidList *list);
bool boid_list_iterator_next(BoidsListNodeIterator *iterator, uboid_t *value);
void boid_list_init(BoidList *list);
void boid_list_append(MemoryArena *arena, BoidList *list, uboid_t new_boid);
void boid_list_append_unique(MemoryArena *arena, BoidList *list, uboid_t new_boid);
void boid_list_to_array(uboid_t *result, BoidList *list);