Using the next entity id as a global to allow reseté

This commit is contained in:
Anonymus Raccoon
2020-05-02 23:54:03 +02:00
parent 956ff64646
commit 6d10f5d03d
+4 -4
View File
@@ -10,18 +10,18 @@
#include "my.h"
#include <stdlib.h>
const gc_entity entity_prefab;
extern const gc_entity entity_prefab;
int entity_next_id = 0;
gc_entity *entity_create(void)
{
static unsigned int next_id = 0;
gc_entity *entity = malloc(sizeof(gc_entity));
if (!entity)
return (NULL);
*entity = entity_prefab;
entity->id = next_id;
next_id++;
entity->id = entity_next_id;
entity_next_id++;
return (entity);
}