25 lines
593 B
C
25 lines
593 B
C
#include "world.h"
|
|
#include "entity.h"
|
|
#include "arena.h"
|
|
#include "scratch.h"
|
|
|
|
void world_alloc(struct world *world)
|
|
{
|
|
MEMZERO_STRUCT(world);
|
|
world->entity_store = entity_store_alloc();
|
|
}
|
|
|
|
void world_copy_replace(struct world *dest, struct world *src)
|
|
{
|
|
__prof;
|
|
struct temp_arena scratch = scratch_begin_no_conflict();
|
|
struct world *old = arena_push(scratch.arena, struct world);
|
|
*old = *dest;
|
|
|
|
MEMCPY_STRUCT(dest, src);
|
|
dest->entity_store = old->entity_store;
|
|
entity_store_copy_replace(dest->entity_store, src->entity_store);
|
|
|
|
scratch_end(scratch);
|
|
}
|